note 39080 modified in function.array-pad by vrana
| From: | vrana@php.net | Date: | Tue, 17 Aug 2004 14:47:57 +0000 |
| Subject: | note 39080 modified in function.array-pad by vrana | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-79777@lists.php.net to get a copy of this message | ||
little older, a little wiser.
ksort() will order the array back into its normal order again
so:
<?php
$myArr = array(2 => 'two', 4 => 'four');
$newArr = array_pad(array(), 6, 'FILLED');
$newArr =$myArr+$newArr;
ksort($newArr);
?>
Will give :
Array ( [0] => FILLED [1] => FILLED [2] => two [3] => FILLED [4] => four [5] =>
FILLED )
--was--
little older, a little wiser.
ksort() will order the array back into its normal order again
so:
$myArr = array(2 => 'two', 4 => 'four');
$newArr = array_pad(array(), 6, 'FILLED');
$newArr =$myArr+$newArr;
ksort($newArr);
Will give :
Array ( [0] => FILLED [1] => FILLED [2] => two [3] => FILLED [4] => four [5] =>
FILLED )
http://php.net/manual/en/function.array-pad.php