Re: http://bugs.php.net/bugs.php?id=8409
| From: | Stig Venaas | Date: | Mon, 08 Jan 2001 17:52:55 +0000 |
| Subject: | Re: http://bugs.php.net/bugs.php?id=8409 | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-43408@lists.php.net to get a copy of this message | ||
On Sat, Jan 06, 2001 at 04:58:53AM +0100, Cynic wrote:
> Can arrays in PHP change a bit, or are they carved in stone
> yet? Is, for example, change to extract() so that
>
> $a = array( 'aaa' , 'bbb' , 'ccc' ) ;
> extract( $a , EXTR_PREFIX_ALL , 'prefix' ) ;
>
> creates $prefix_1 , $prefix_2, and $prefix_3 in current scope?
> And what about changing it so that it returns? I'd like to see
> extract() return maybe number of variables it created.
This sounds like a good idea, should be backwards compatible. Except
that I think the result should be
creates $prefix0, $prefix1, and $prefix2 in your case. After all the
indices are 0, 1 and 2, and adding _ doesn't seem natural. You can
call your prefix prefix_ then.
To return the number of variables sounds good to me, but won't it
always be the same as the number of elements in the array?
Stig