3v4l.org

run code in 300+ PHP versions simultaneously
<?php class X { private $y = null; public function __construct($y=null) { $this->y = (int)$y; } } function evilSearch($obj, $p=-2147483648, $q=2147483647, $max = 32, $c = 0) { if($c>$max) { return null; } $class = get_class($obj); $r = (int)(($p+$q)/2); $z = new $class($r); if($z>$obj) { return evilSearch($obj, $p, $r, $max, $c+1); } if($z<$obj) { return evilSearch($obj, $r, $q, $max, $c+1); } return $r; } echo('<pre>'); $test = new X(mt_rand()); var_dump(evilSearch($test), $test);

preferences:
36.27 ms | 402 KiB | 5 Q