Beware, if you try to pad an associative array using numeric keys, your keys will be re-numbered.
<?php
$a = array('size'=>'large', 'number'=>20, 'color'=>'red');
print_r($a);
print_r(array_pad($a, 5, 'foo'));
// use timestamps as keys
$b = array(1229600459=>'large', 1229604787=>20, 1229609459=>'red');
print_r($b);
print_r(array_pad($b, 5, 'foo'));
?>
yields this:
------------------
Array
(
[size] => large
[number] => 20
[color] => red
)
Array
(
[size] => large
[number] => 20
[color] => red
[0] => foo
[1] => foo
)
Array
(
[1229600459] => large
[1229604787] => 20
[1229609459] => red
)
Array
(
[0] => large
[1] => 20
[2] => red
[3] => foo
[4] => foo
)