You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
517 B
PHTML
20 lines
517 B
PHTML
5 years ago
|
<?php
|
||
|
function entity_sort($my_array) {
|
||
|
$total = count($my_array);
|
||
|
for ($i=0;$i<$total;$i++) {
|
||
|
if ($my_array[$i]{0} == '&') {
|
||
|
$my_array[$i] = $my_array[$i]{1}.$my_array[$i];
|
||
|
} else {
|
||
|
$my_array[$i] = $my_array[$i]{0}.$my_array[$i];
|
||
|
}
|
||
|
}
|
||
|
sort($my_array);
|
||
|
for ($i=0;$i<$total;$i++) {
|
||
|
$my_array[$i] = substr($my_array[$i],1);
|
||
|
}
|
||
|
return $my_array;
|
||
|
}
|
||
|
$arr = array(" ","&", "<");
|
||
|
print_r(entity_sort($arr));
|
||
|
?>
|