- strcmp: documentation ( source)
- print_r: documentation ( source)
- usort: documentation ( source)
<?php
class T {
public function __construct($v)
{
$this->v = $v;
}
public function __toString()
{
return 'a';
}
}
$list = array(new T(1), new T(2));
usort($list, function($a, $b) {
return strcmp($a, $b);
});
// PHP has 2, then 1
// HHVM has 1, then 2
print_r($list);