Skip to content

Instantly share code, notes, and snippets.

@giorgiosironi
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giorgiosironi/4d49638448e9c8ea63c0 to your computer and use it in GitHub Desktop.
Save giorgiosironi/4d49638448e9c8ea63c0 to your computer and use it in GitHub Desktop.
Verifying sort() over an input
sort($array);
for ($i = 0; $i < count($array) - 1; $i++) {
$this->assertTrue(
$array[$i] <= $array[$i+1],
"Array is not sorted: " . var_export($array, true)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment