I have an array of arrays in php called $searchResults
. Each array within $searchResults
is formatted as such:
array('name' => <name> , 'value' => <value>)
I want to encode this two dimension array as a JSON array and pass it back to my JavaScript. How can I encode this array in PHP such that I can decode it in JavaScript and then iterate through each array by key? Is this even possible? I have found examples of encoding multidimensional arrays that don't use the <key> => <value>
syntax but I am not really sure if these are applicable. An example would be here. Thanks!