Skip to content

Instantly share code, notes, and snippets.

@m4tm4t
Created July 30, 2013 14:02
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 m4tm4t/6113155 to your computer and use it in GitHub Desktop.
Save m4tm4t/6113155 to your computer and use it in GitHub Desktop.
sort array php
<?php
$array = array('abc', 'zabc', 'zbac', 'bouh', 'AbC', 'Zoubidou');
$array_size = count($array);
for ($i=0; $i < $array_size; $i++) {
for ($j=1; $j < $array_size; $j++) {
$holder = $array[$j];
if (strtolower($array[$j]) < strtolower($array[$j-1])) {
$array[$j] = $array[$j-1];
$array[$j-1] = $holder;
}
}
}
print_r($array);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment