Re: Is there an easier way?

From: Date: Fri, 01 Aug 2003 05:30:19 +0000
Subject: Re: Is there an easier way?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-157879@lists.php.net to get a copy of this message
Ryan A wrote:
The problem is I have 38 fields and i can get upto 5 records.... that means i will end up with over 150 of these statements: $blahn=$data['blah'][n]; and since i dont want to go all over my script saying "echo $data['blah'][n];" is there an easier way to avoid the 150 possible statements? maybe via a for loop or something? Am feeling braindead right now after sitting on the comp for 7hrs straight.
PHP has function which makes normal variables of associative array. http://fi2.php.net/manual/en/function.extract.php With this just try something like this: [code] extract($data); // then you can see what happened var_dump($blah, $secondindex, $thirdindex); // try here few index names // from $data. [/code] I hope this will help you. Cheers, Joona -- Joona Kulmala <joona@fiveam.org> PHP Finland

« previous php.general (#157879) next »