Voting

: min(four, zero)?
(Example: nine)

The Note You're Voting On

me[ at ]szczepan[ dot ]info
12 years ago
Sorting the keys, but keep the values in order is not possible by just ordering, because it would result in a new array. This is also the solution: Create a new array

<?php
$a
= array(9=>"a",8=>"c",5=>"d");

$keys = array_keys($a);
sort($keys);
$result = array_combine($keys, array_values($a));

//Result : array(5=>"a",8=>"c",9=>"d");
?>

<< Back to user notes page

To Top