Recent Topics

unset($this); need alternative

Started by on Nov 24, 2006 – Contents updated: Nov 24, 2006

Nov 24, 2006 13:29    

In my classes I've made, if the constructor receives invalid data that makes the whole instance of the class useless i would use unset($this); or $this = NULL;, but I've just moved to PHP5 and this is no longer supported.... Which is a real pain in the ass. Any suggestions on how i should now go about this...?

Nov 24, 2006 18:08

Use a factory, which returns either NULL or the object, if it's valid (e.g. according to some property).

Nov 25, 2006 03:23

A factory?

Atm what i've done is used return NULLs for the functions and i have a status variable that i set to NULL.


Form is loading...

Responsive CMS – This forum is powered by b2evolution CMS, a complete engine for your website.