Skip to content

Instantly share code, notes, and snippets.

@dave1010
Created February 28, 2014 16:59
Show Gist options
  • Save dave1010/9274861 to your computer and use it in GitHub Desktop.
Save dave1010/9274861 to your computer and use it in GitHub Desktop.
HHVM and PHP usort difference
<?php
class T {
public function __construct($v)
{
$this->v = $v;
}
public function __toString()
{
return 'a';
}
}
$list = [new T(1), new T(2)];
usort($list, function($a, $b) {
return strcmp($a, $b);
});
// PHP reverses $list but HHVM doesn't touch it
print_r($list);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment