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

(This post was last modified: 04-06-2018, 12:30 AM by SomeGuy.)

Hope you decided to return NULL.

Returning an empty array when there are no results is not the same as returning an array with known keys. You'll have to validate the array before you can actually use it.

PHP Code:
if(NULL !== ($attachments $model->getAttachments())) : 
# Hey, I have valid attachments and not just some returned value that looks like I do.
endif; 
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



Theme © iAndrew 2016 - Forum software by © MyBB