Question: Which of the following functions will sort an array in ascending order by value, while preserving key associations?
A
B
C
D
E
asort()
B
C
D
E
Note: Not available
<?php
$a = "The quick brown fox jumped over the lazy dog.";
$b = array_map("strtoupper", explode(" ", $a));
foreach($b as $value) {
print "$value ";
}
?>
<?php
$a = array(0.001 => 'b', .1 => 'c');
print_r($a);
?>
A
through Z
, that allowed you to access each letter independently, which of the following approaches could you use?
<?php
$array = array(1 => 0, 2, 3, 4);
array_splice($array, 3, count($array), array_merge(array('x'), array_slice($array, 3)));
print_r($array);
?>
<?php
$array = array('a' => 'John',
'b' => 'Coggeshall',
'c' => array('d' => 'John',
'e' => 'Smith'));
function display($item, $key) {
print "$key => $item\n";
}
array_walk_recursive($array, "display");
?>
<?php
$array = array('a' => 'John',
'b' => 'Coggeshall',
'c' => array('d' => 'John',
'e' => 'Smith'));
function something($array) {
extract($array);
return $c['e'];
}
print something($array);
?>