Is it possible to put Variable in Array? Here is what I need:
$array = Array($a,$b);
$a = 'something';
$b = 'something else';
foreach ($array as $val) {
echo "$val";
}
Output should be:
something
something else
Array is:
Array
(
[0] => $a
[1] => $b
)
If this is not possible is there any other way to do this? Thing is that
I need to display some data based on array content.
So far I have used:
if (in_array('5', $array)) {
echo 'data that should be display based on array value. I cant put this
data in array because array is stored in cookie and then read';
}
$array = Array($a,$b);
$a = 'something';
$b = 'something else';
foreach ($array as $val) {
echo "$val";
}
Output should be:
something
something else
Array is:
Array
(
[0] => $a
[1] => $b
)
If this is not possible is there any other way to do this? Thing is that
I need to display some data based on array content.
So far I have used:
if (in_array('5', $array)) {
echo 'data that should be display based on array value. I cant put this
data in array because array is stored in cookie and then read';
}
Comment