3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Person { public $sname; public $fname; public $age; public function __construct($a,$b,$c) { $this->sname = $a; $this->fname = $b; $this->age = $c; return $this; } } $horrible_array_of_stuff = array( new Person("Owen", "Dyckhoff", 27), new Person("Joe", "Bloggs", 36 ) ); print_r($horrible_array_of_stuff); echo "Sorting Array of Objects\n" usort( $horrible_array_of_stuff, function( $left, $right ) { return [$left->sname, $left->fname, $left->age] <=> [$right->sname, $right->fname, $right->age]; } ); print_r($horrible_array_of_stuff);
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16
Parse error: syntax error, unexpected 'usort' (T_STRING), expecting ',' or ';' in /in/3p9td on line 23
Process exited with code 255.

preferences:
169.55 ms | 1399 KiB | 23 Q