I have an array, let's say it's the following:
Code: Select all
$array=("see","the","squirrel","be","the","monkey");
Only in real life, the array has a whole lotta entries (maybe 100, maybe 500, who knows?). I would like to make a concatonated variable using each of these array entries. These concatonated variables will be used later in the same page. For instance, I think it should work the following way (but it doesn't):
Code: Select all
foreach($array as $words){
$words._test = $words." works";
}
Let's assume this worked. If it did, then the following call would produce the result that follows it:
Code: Select all
print"List of variables:<br> $see_test <br> $the_test <br> $squirrel_test <br> $be_test <br> $the_test <br> $monkey_test";
//-----produces the following:
List of variables:
see works
the works
squirrel works
be works
the works
monkey works
Now, bear in mind this DOES NOT work. Does anyone know how to make it work? I want to make variables called names that come from variables concatonated with strings. These are a few of my favorite things.