Welcome Guest, Not a member yet? Register   Sign In
What is better when return false
#7

PHP Code:
if (!empty($array))
{
 
   /**
     * empty() is very useful for dealing with PHP arrays since it returns true
     * if your array variable is null or an empty array, and also gracefully
     * returns true if your array variable is undefined.
     *
     * this code runs if $array is defined, not null, and not an empty array()
     */
 
   return $array;
}
else
{
 
   // $array is empty, null or undefined so return true
 
   return true;


empty is great for arrays, but very bad for using on strings "0".
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: What is better when return false - by rtenny - 06-30-2017, 07:08 AM
RE: What is better when return false - by SomeGuy - 04-06-2018, 12:29 AM
RE: What is better when return false - by InsiteFX - 04-06-2018, 12:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB