note 64860 deleted from function.extract by bjori
| From: | bjori@php.net | Date: | Sat, 22 Apr 2006 01:37:55 +0000 |
| Subject: | note 64860 deleted from function.extract by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-108974@lists.php.net to get a copy of this message | ||
Note Submitter: Don't supply underscore in prefix!
Reason: useless
----
I found this out the hard way. The book I'm reading does not actually show an example of a
prefix, and it just finally dawned on me when I was reading this page.
I'm using EXTR_PREFIX_ALL but it wasn't working. I kept trying to find the error (I
thought it must be a spelling or syntax error...well, I suppose it qualifies as a syntax error, but
you wouldn't know), and I saw nothing wrong with my code, but none of the array values were
getting echoed to the page.
[b]You [color=red]cannot[/color] supply an underscore in your prefix.[/b] The underscore is
automatically supplied by the function. You'd think it would just result in 2 underscores in a
row, but this is not the case. This function must not allow an underscore in this prefix string.
[b]acceptable: [/b][size=small]extract($slideshowPics, EXTR_PREFIX_ALL, 'PIC');[/size]
[b][color=red]not[/color] acceptable :[/b][size=small]extract($slideshowPics, EXTR_PREFIX_ALL,
'PIC_');[/size]
I was did not provide an underscore because I wasn't aware the function supplied it. And if I
had prefered no underscore, I would have found out that the function supplied it anyway.