3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class foo { function __toString() { return "x"; } } var_dump(strpos(new foo, "x")); var_dump(strpos("x", new foo));
Output for 5.2.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
int(0) Notice: Object of class foo could not be converted to int in /in/QU6C2 on line 8 bool(false)
Output for hhvm-3.10.0
int(0) Notice: Object of class foo could not be converted to int in /in/QU6C2 on line -1 bool(false)
Output for 5.1.0 - 5.1.6
Notice: Object of class foo to string conversion in /in/QU6C2 on line 7 bool(false) Notice: Object of class foo could not be converted to int in /in/QU6C2 on line 8 bool(false)
Output for 5.0.0 - 5.0.5
Notice: Object of class foo to string conversion in /in/QU6C2 on line 7 bool(false) bool(false)
Output for 4.3.0 - 4.4.9
Notice: Object to string conversion in /in/QU6C2 on line 7 bool(false) bool(false)