php 5.3 - Parse error: syntax error, unexpected '[' with php 5.3 -


this question has answer here:

my script working fine on xampp. tried upload on server, spat directly a

parse error: syntax error, unexpected '['

in face. :(

the line mocking one:

    $item = $xml->xpath($path)[0]; 

and have no idea wrong. tried on php 5.3 changelog did not found it. (because have 5.3 on server, , on xampp olderversion)

the whole code block looks this:

$path = '//item[@id="'.$id.'"]'; if ($xml->xpath($path)) {     $item = $xml->xpath($path)[0]; } else {     die('<p class="error">script error: code 101 - please contact administrator</p>'); } 

i thankful help, cannot seach [ google , have no idea come from, since on xampp working fine

try $item = $xml->xpath($path);
$item = $item[0];


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -