// assigning a variable inside an IF conditional does assign the value,
// then if it evaluates to true, continues to the true statement group
<?php
$a = array(1, 2, ' ', true, 0, '', false, array());
foreach ($a as $b) {
if ($c[] = $b) {
echo 'true, ';
} else {
echo 'false, ';
}
}
print_r($c);
/* RETURNS
true, true, true, true, false, false, false, false
Array
(
[0] => 1 // integer
[1] => 2 // integer
[2] => // a single space
[3] => 1 // boolean true
[4] => 0 // integer
[5] => // nothing
[6] => // nothing
[7] => array()
)
*/
?>
// Notice $c[4] and $c[7] are assigned values, but then evaluate to false