I'm seeing some slightly odd behaviour, and i'm wondering if anyone feels like poking their nose in it with me...
Basic premise is this. I'm storing the string "$randicon" in a db field, and this string is retrieved and stored in the variable $items[1]->image. I'm trying to eval it, as $randicon is set as, well, a random image name earlier in the script. So far, this works fine for me:
$image = $items[1]->image;
eval ("\$image = \"$image\";");
echo $image;
All of which is a little bit too much to place in-line 100 times or more in my site - so I decided to make it a function, for that extra bit of clarity:
function evalImage($image) {
eval ("\$image = \"$image\";");
print $image;
}
Then, of course, to call it as this:
evalImage($items[1]->image);
yet it doesn't work. The string "$randicon" gets passed to the function alright, but $image ends up being blank. I'm a little confused as to this, it seems like a fairly straight forward thing to do, yet it's not working. I've tried the ob_ series of functions aswell, all to no avail. Anyone seen this behaviour before or have some light to possibly shed on it?