Php Convert Nested Array Formula Function