Syntax error in PHP with an array -


i have type of array:

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

in code use make display table error , success messages.

foreach($results $innerarr) {     if(array_keys($innerarr)[0]=='error') { $css = 'style="background:red"'; }     if(array_keys($innerarr)[0]=='success') { $css = 'style="background:green"'; }      echo '<tr>';     echo '<td '.$css.'></td>';     echo '<td>'.array_values($innerarr)[0].'</td>';     echo '</tr>'; } 

my problem is: time type of error:

[tue mar 31 09:44:48 2015] [error] [client 172.***.140.***] php parse error: syntax error, unexpected '[' in upload.php on line 229, referer: http://****.com/verification/index.html 

as have php 5.2, how can solve problem please ?

thanks.

upgrade php 5.4

alternatively, you'll have screw around temporary variables. function return value dereferencing added in 5.4


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 -