Re: http://bugs.php.net/bugs.php?id=8409
| From: | Stig Venaas | Date: | Mon, 08 Jan 2001 21:35:04 +0000 |
| Subject: | Re: http://bugs.php.net/bugs.php?id=8409 | ||
| References: | 1 2 3 4 5 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-43469@lists.php.net to get a copy of this message | ||
On Mon, Jan 08, 2001 at 03:05:05PM -0600, Andrei Zmievski wrote:
> On Mon, 08 Jan 2001, Stig Venaas wrote:
> > Returning the number of variables sounds like a good idea then.
> >
> > If you agree this is good I could always try to implement it unless
> > cynic or you wants to.
>
> It's been done. Maybe someone could update the docs as well.
Great, I'll fix the doc.
I see two problems with the extract() code. You check that the key
is a legal variable name but not that prefix_key is. There are two
problems with this.
$a = array( '1a' => 'b' ) ;
extract($a, EXTR_PREFIX_ALL , 'prefix') ;
should set $prefix_1a but doesn't since '1a' isn't legal.
and
$a = array( 'a' => 'b' ) ;
echo extract($a, EXTR_PREFIX_ALL , '1prefix') ;
puts the key (variable) '1prefix_a' into the symbol table.
Stig