note 91461 added to language.variables.variable

From: Date: Thu, 11 Jun 2009 00:24:51 +0000
Subject: note 91461 added to language.variables.variable
Groups: php.notes 
Request: Send a blank email to php-notes+get-156760@lists.php.net to get a copy of this message
@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 ?> ---- Server IP: 213.249.64.162 Probable Submitter: 213.10.57.125 ---- Manual Page -- http://www.php.net/manual/en/language.variables.variable.php Edit -- https://master.php.net/note/edit/91461 Del: integrated -- https://master.php.net/note/delete/91461/integrated Del: useless -- https://master.php.net/note/delete/91461/useless Del: bad code -- https://master.php.net/note/delete/91461/bad+code Del: spam -- https://master.php.net/note/delete/91461/spam Del: non-english -- https://master.php.net/note/delete/91461/non-english Del: in docs -- https://master.php.net/note/delete/91461/in+docs Del: other reasons-- https://master.php.net/note/delete/91461 Reject -- https://master.php.net/note/reject/91461 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#156760) next »