note 103721 deleted from function.list by danbrown
| From: | danbrown@php.net | Date: | Fri, 29 Apr 2011 16:49:50 +0000 |
| Subject: | note 103721 deleted from function.list by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179283@lists.php.net to get a copy of this message | ||
Note Submitter: cHao
----
Re: lili at nikha dot org: PHP already has a function to extract elements from an array into
variables with the same name. It's called "extract".
<?php
$petnames = array();
$petnames['dog'] = 'Paul';
$petnames['cat'] = 'Lili';
extract($petnames);
echo 'my pets are '.$dog.' and '.$cat;
?>