I’m reading book about php, and here is task to print elements of array depends on their type;
So i created array $arr = array (5, 'str', 4, 'str1', -100, 10);, and then using foreach statement i tried to print elements that are integer
foreach ($arr1 as is_integer($arrelem))
{
print $arrelem;
}
But this gives me an errorFatal error: Can't use function return value in write context in.
I’m sure there is something wrong with algorithm, but i need advice on how to understand these alhorighms
foreach ($arr1 as is_integer($arrelem))is not allowedWrite it like so:
If this is for debugging you can also use
var_dump, which will give you the type and value of a variable.