PHP – sort different

June 13th, 2011

<?php
$a = array(2,    "a",  "11", 2);
$b = array(2,    "11", "a",  2);
sort($a);
var_dump($a);
sort($b);
var_dump($b);


/*

Output:

array(4) {
  [0]=>
  string(2) "11"
  [1]=>
  string(1) "a"
  [2]=>
  int(2)
  [3]=>
  int(2)
}
array(4) {
  [0]=>
  int(2)
  [1]=>
  int(2)
  [2]=>
  string(2) "11"
  [3]=>
  string(1) "a"
}

 

*/

?>

PHP , ,