programming-examples/php/Arrays/PHP script to sort an array using case-insensitive natural ordering.php

10 lines
216 B
PHP
Raw Normal View History

2019-11-15 12:59:38 +01:00
<?php
$colors = array(
"color1", "color20", "color3", "color2"
);
sort($colors, SORT_NATURAL | SORT_FLAG_CASE);
foreach ($colors as $key => $val) {
echo "Colors[" . $key . "] = " . $val . "\n";
}
?>