I need the output of this to be:
This is another
This is awesome
[syntax=php]<?php
$variable_one = array ("one"=>"This is one", "two"=>"This is another");
$variable_two = array ("one"=>"This is two", "two"=>"This is working lol");
$variable_three = array ("one"=>"This is three", "two"=>"This is awesome!");
$user_selection = array ("$variable_one", "$variable_three");
foreach($user_selection as $feed){
extract($feed);
echo $two;
}
?>[/syntax]
I think my thought process is right but I get this error:
Warning: extract() [function.extract]: First argument should be an array in /home/a6972369/public_html/test/index.php on line 10
Would anybody be able to help?
Cheers for your time =]
Extracting a key variable from an array within an array :S
Re: Extracting a key variable from an array within an array
My bad...
I had placed " " around the variables within the $user_selection array
Solved!
I had placed " " around the variables within the $user_selection array
Solved!
Re: Extracting a key variable from an array within an array
[syntax=php]$user_selection = array ("$variable_one", "$variable_three");[/syntax]
No need for the quotes on this line
Also I have never seen extract() actually being used for somethign that makes sense, so good job !
No need for the quotes on this line
Also I have never seen extract() actually being used for somethign that makes sense, so good job !