php 5.3 - Parse error: syntax error, unexpected '[' with php 5.3 -
this question has answer here:
- php syntax dereferencing function result 22 answers
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
Post a Comment