Jump to content

checking the array


karthikanov24

Recommended Posts

hi

$child  = array_merge($child, getChildCategories($categories, $catId));

 

In the above line of code,the value(return value) of the function getChildCategories() is an array....

how to check(what debugging code is used) whether there is any value or in that function(or array) or it is null....?

 

 

thanks

karthikanov24

Link to comment
Share on other sites

Without curly braces only the first 'line' of code following the statement will be done as part of the statement. But whitespace doesn't make the slightest bit of difference.

 

// this
if(true) 

   echo "True";

else 

echo "False";

// is exactly the same as this
if(true) echo "True";
else echo "False";

I would always recommend a variation of this as the 'correct' way of doing it. Otherwise you can introduce problems when you complicate things.

 

if(true) {
   echo "True";
} else {
   echo "False";
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.