On Fri, May 04, 2001 at 08:08:11PM -0400, John McConnell wrote:
I have an array $veg that is set so $veg[0]=broccoi $veg[1]=tomatotes.
I have also assigned values to the variables $broccoli=1 and $tomatoes=2.
I want to print the values for those variables ($broccoli and $tomatoes) by
only
I have an array $veg that is set so $veg[0]=broccoi $veg[1]=tomatotes.
I have also assigned values to the variables $broccoli=1 and $tomatoes=2.
I want to print the values for those variables ($broccoli and $tomatoes) by
only using the $veg array.
So, if it worked it would be $$veg[0] would be
An example :
?php
$array = array('a' = 'apple',
'b' = 'banana',
'c' = 'cranberry');
print $array['a']; // apple
print $array['b']; // banana
extract($array);
print $a;// apple
print $b;// banana
Array value as variable
An example :
?php
$array = array('a' = 'apple',
'b' = 'banana',
'c' = 'cranberry');
print $array['a']; // apple
print $array['b']; // banana
extract($array);
print $a;// apple
print $b;// banana
$var = 'array';
print
4 matches
Mail list logo