note 67085 modified in function.array-unshift by danbrown
| From: | danbrown@php.net | Date: | Wed, 12 Aug 2009 16:40:02 +0000 |
| Subject: | note 67085 modified in function.array-unshift by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-159380@lists.php.net to get a copy of this message | ||
I had a need tonight to convert a numeric array from 1-based to 0-based, and found that the
following worked just fine due to the "side effect" of renumbering:
<?php
array_unshift( $myArray, array_shift( $myArray ));
?>
--was--
I had a need tonight to convert a numeric array from 1-based to 0-based, and found that the
following worked just fine due to the "side effect" of renumbering:
array_unshift( $myArray, array_shift( $myArray ));
http://php.net/manual/en/function.array-unshift.php