Created
February 28, 2014 16:59
-
-
Save dave1010/9274861 to your computer and use it in GitHub Desktop.
HHVM and PHP usort difference
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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