note 64860 added to function.extract

From: Date: Sat, 22 Apr 2006 01:13:47 +0000
Subject: note 64860 added to function.extract
Groups: php.notes 
Request: Send a blank email to php-notes+get-108972@lists.php.net to get a copy of this message
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. ---- Server IP: 66.163.161.117 Probable Submitter: 71.83.52.146 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.extract.php Edit -- http://master.php.net/note/edit/64860 Del: integrated -- http://master.php.net/note/delete/64860/integrated Del: useless -- http://master.php.net/note/delete/64860/useless Del: bad code -- http://master.php.net/note/delete/64860/bad+code Del: spam -- http://master.php.net/note/delete/64860/spam Del: non-english -- http://master.php.net/note/delete/64860/non-english Del: in docs -- http://master.php.net/note/delete/64860/in+docs Del: other reasons-- http://master.php.net/note/delete/64860 Reject -- http://master.php.net/note/reject/64860 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#108972) next »