arrays - How to change my function to work with PHP 5.2 -


i have array:

array(     [0] => array(         [success] => file uploaded.     )[1] => array(         [error] => file doesn 't exist.     )[2] => array(         [success] => file supported.     ) ) 

how can loop in array echo this:

success = file uploaded 

i have tried with:

foreach($results $innerarr) {   array_keys($innerarr)[0]; } 

which works fine on current php version. because have php 5.2 , can't change it, doesn't work.

function return value dereferencing added in 5.4.

you can't prior 5.4:

array_keys($innerarr)[0]; 

so:

$foo = array_keys($innerarr); $bar = $foo[0]; 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -