popcornplya Posted February 13, 2009 Share Posted February 13, 2009 Is there a point in declaring an array? like $test = array(); $test[] = 'whatever'; even though it works without it and what is the difference between if(!$test) and if(!isset($test)) Quote Link to comment Share on other sites More sharing options...
samshel Posted February 13, 2009 Share Posted February 13, 2009 defining an array - it is a good standard practise to do so. - if there is already a variable with the same name, it will clean it. if(!$test) - will fail if $test is not set or 0 or false or null. and if(!isset($test)) - will fail only when $test is not set. Quote Link to comment Share on other sites More sharing options...
printf Posted February 13, 2009 Share Posted February 13, 2009 Anytime you don't define something and try to use it, you will get some kind of warning / notice. It's like using coding shortcuts, just because you can doesn't mean you should. Code presentation is as important as code logic, especially when developing a full scale applications! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.