php’s foreach on a string? you can do that.
Reminder to self:
Normally, to do a foreach must be something like array(”oliver”,”nassar”). I’ve run into a situation where I didn’t if a variable, lets say $wtf, was an array or just a string. Running foreach on a string results in a notice like “Warning: Invalid argument supplied for foreach() inĀ /random/file/path.php on lineĀ #line-number“.
Just write this, and you should be good:
foreach((array)$unknown as $key=>$value)
echo "go nuts.";
?>