What will be the result of executing of following code?
$arr = array(1,3,5);
$count = count($arr);
if ($count = 0) {
    echo "Empty array.";
} else {
    echo "Array consist of $count elements.";
}
Explanation
$arr = array(1,3,5);
$count = count($arr);
if ($count = 0) { // means assign 0 to $count
    echo "Empty array.";
} else {
    echo "Array consist of $count elements.";
}
In case if ($count == 0) // result would be Array consist of 3 elements.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
PHP quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes