3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { private static $data = array( 'banana', 'cherry', 'apple' ); private static function sort_by_text( $first, $second ) { return strcasecmp( $first, $second ); } public static function sorted_data() { usort( self::$data, array( __CLASS__, 'sort_by_text' ) ); return self::$data; } } print_r( MyClass::sorted_data() ); usort( array( 'banana', 'cherry', 'apple' ), array( __CLASS__, 'sort_by_text' ) );
Output for git.master, git.master_jit
Array ( [0] => apple [1] => banana [2] => cherry ) Fatal error: Uncaught Error: usort(): Argument #1 ($array) could not be passed by reference in /in/SS18e:16 Stack trace: #0 {main} thrown in /in/SS18e on line 16
Process exited with code 255.
Output for rfc.property-hooks
Array ( [0] => apple [1] => banana [2] => cherry ) Fatal error: Uncaught Error: usort(): Argument #1 ($array) cannot be passed by reference in /in/SS18e:16 Stack trace: #0 {main} thrown in /in/SS18e on line 16
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
33.63 ms | 401 KiB | 8 Q