PHP: Assigning values to a variable inside IF statement
- by Matt
Hi guys,
I was wondering if i could assign values to a variable inside an IF statement. My code is as follows:
<?php
if ((count($newArray) = array("hello", "world")) == 0) {
// do something
}
?>
So basically i want assign the array to the $newArray variable, then count newArray and check to see if it is an empty array.
I know i can do this on several lines but just wondered if i could do it on one line
Thanks
M