Bellow statement showing Parse Error
echo $xmlArray[OTA_HotelAvailRS][Properties][Property][0_attr][HotelCityCode];
error: syntax error, unexpected T_STRING, expecting ']'
how to solve this?
PHP assumes unquoted literals to be constants and constant names can't start with numbers. This results as 0_attr
being parsed to a number 0 followed by a constant _attr
- which does not amke any sense.
ALWAYS quote array indices.
echo $xmlArray['OTA_HotelAvailRS']['Properties']['Property']['0_attr']['HotelCityCode'];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With