Skip to content

Instantly share code, notes, and snippets.

@cirpo
Created July 2, 2010 20:46
Show Gist options
  • Save cirpo/461884 to your computer and use it in GitHub Desktop.
Save cirpo/461884 to your computer and use it in GitHub Desktop.
<?php
function compare($a, $b){
return $a < $b ? -1 : 1;
}
$array_one = array( 0 => 1234, 1 => 5678, 2 => 7777, 3 => 3333);
$array_two = array( 0 => 9999, 1 => 5678, 2 => 8888, 3 => 1234);
var_dump($array_one);
var_dump($array_two);
$array_merged = array_merge($array_one, $array_two);
var_dump($array_merged);
usort($array_merged, 'compare');
var_dump($array_merged);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment