3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array( 'ua' => array( 'family', 'major' ), 'os' => array( 'family', 'major' ) ); $result = new StdClass(); $result->ua->family = "Safari"; $result->ua->major = "6"; $result->ua->minor = "0"; $result->ua->patch = "2"; $result->ua->toString() = "Safari 6.0.2"; $result->ua->toVersion() = "6.0.2"; $result->os->family = "Mac OS X"; $result->os->major = "10"; $result->os->minor = "7"; $result->os->patch = "5"; $result->os->patchMinor = "[null]"; $result->os->toString() = "Mac OS X 10.7.5"; $result->os->toVersion() = "10.7.5"; array_intersect_key( (array) $result, $data );
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.28, 5.4.0 - 5.4.26
Fatal error: Can't use method return value in write context in /in/lTYuC on line 11
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '=' in /in/lTYuC on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected '=' in /in/lTYuC on line 11
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/lTYuC on line 11
Process exited with code 255.

preferences:
235.3 ms | 1399 KiB | 116 Q