conceptual - difference between these two return statements in php -


we wondering best way return empty null no result in php, use this

function dothis($a){    if($a == 0){        return '';    }else{        // complex mysql         return $result; } 

one more way of doing

function dothis($a){    if($a == 0){        return null;    }else{        // complex mysql         return $result; } 

now compare this

if(dothis(5)){     // } 

or

if(!is_null(dothis(5)){     // } 

i wondering best approach doing ?

there problem in function dothis near if($a = 0){.

== used compare.

= used assign value.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -