note 93596 deleted from control-structures.foreach by danbrown
| From: | danbrown@php.net | Date: | Thu, 17 Sep 2009 17:35:04 +0000 |
| Subject: | note 93596 deleted from control-structures.foreach by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160801@lists.php.net to get a copy of this message | ||
Note Submitter: hueen
----
Re previous post: Unless I missed something, doesn't this achieve the same thing?:
<?php
$deviations = array(
3 => 'oranges',
5 => 'pears',
);
$standards = array_fill(1, 9, 'apples');
$result = $deviations + $standards;
ksort($result); //sort by key
print_r($result);
// Output:
// Array
// (
// [1] => apples
// [2] => apples
// [3] => oranges
// [4] => apples
// [5] => pears
// [6] => apples
// [7] => apples
// [8] => apples
// [9] => apples
// )
?>