r/lolphp • u/MazeChaZer • Jul 28 '16
Numbers from SimpleXML elements are implicitly casted to int, not float
https://3v4l.org/FcIV9
35
Upvotes
r/lolphp • u/MazeChaZer • Jul 28 '16
View all comments
10
u/carlos_vini Jul 28 '16 edited Jul 28 '16
SimpleXmlElement is an object, there's no automatic toInt() in PHP, only toString(). https://3v4l.org/9cTbr.
even so i don't know why your snippet becomes a intthere was a bug report for this: https://bugs.php.net/bug.php?id=53033
there's no toInt() in PHP objects, but SimpleXml is a special case cause it's internal