note 91461 deleted from language.variables.variable by danbrown
| From: | danbrown@php.net | Date: | Thu, 11 Jun 2009 00:27:00 +0000 |
| Subject: | note 91461 deleted from language.variables.variable by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156761@lists.php.net to get a copy of this message | ||
Note Submitter: mail at martijngp dot nl
----
@Mark Stoddart:
I've been looking at that as well as I needed to change the array $item that I had to
'normal' variables (ie $item[ 'url' ] has to become $item_url).
I did it this way, maybe you or someone else can make use of this. You just apply the prefix before
actually creating the variable.
<?php
$item = array( "xml_url" => "some_xml_file.xml" );
foreach( $item as $tag => $value ) {
$temp_tag = "item_" . $tag;
$$temp_tag = $value;
}
echo $item_xml_url; // output: some_xml_file.xml
?>