RE: [PHP-DEV] Patch to extract()
| From: | Richard Heyes | Date: | Wed, 27 Feb 2002 23:37:34 +0000 |
| Subject: | RE: [PHP-DEV] Patch to extract() | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-80481@lists.php.net to get a copy of this message | ||
Anyone interested in this patch?
--
Richard Heyes
"If you have any trouble sounding condescending,
find a Unix user to show you how it's done." - Scott Adams
> -----Original Message-----
> From: Richard Heyes [mailto:richard@phpguru.org]
> Sent: 25 February 2002 16:18
> To: PHP Dev
> Subject: [PHP-DEV] Patch to extract()
>
>
> I've added an extra option extract() to have potential variable
> names passed
> to a user defined callback function. If this function then returns true,
> it's extracted, if not it's not.
>
> Anyone care to apply/check it?
>
> Eg.:
>
> <?php
> function extract_callback($varname){
> return preg_match('/^var/', $varname);
> }
>
> $var['var_1'] = 1;
> $var['var_2'] = 1;
> $var['blaat'] = 1;
>
> extract($var, EXTR_USER_CALLBACK, 'extract_callback');
>
> printf('var_1: %s <br>', $var_1);
> printf('var_2: %s <br>', $var_2);
> printf('blaat: %s <br>', $blaat);
> ?>
>