3v4l.org

run code in 300+ PHP versions simultaneously
<?php class _Stringable { public $value; public function __construct($value) { $this->value = $value; } public function __toString() { return $this->value; } } class NonStringable { public $value; public function __construct($value) { $this->value = $value; } } $items = array( new _Stringable('A'), new _Stringable('B'), new NonStringable('C') ); asort($items); var_dump($items);

preferences:
59.2 ms | 402 KiB | 5 Q