Using PHP5.3, I can use a function directly in a condition,like this :
if(my_function($var) == 'hello') {...}
But sometimes, even if I know what the function would return, I have a PHP bug and I have to do like this :
$result = another_function($var);
if($result == 'world') {...}
If both functions would return a string, why can I use the first and not the second ? I want to understand what the if
condition can accept. Are all PHP natives functions are ok ? does the if
condition doesn't want a method MyObject->my_function($var) ?