On Wednesday 14 September 2005 03:42 pm, bruce wrote: > hi... > > i have the following psuedo code... > > i'm showing the pertinent parts, and eliminating the rest... > > ------------------------------------------ > class sql > { > > function sql(...) > { > return false > > mysql_.... > > mysql_.... > } > > } > > $db = new sql(...) The new sql() is returning an object because that is what your asking for. now if you did a $db->sql() that'd return false. yes you did put a return false in the constructor but an object is what is being created and thus what is being returned. In my opinion a return anything within the constructor shouldn't be allowed. This might be the behavior in newer versions but I don't know. newer syntax is: class sql { function __construct (...) { ... } } truthfully when you do the $db = new sql(...); you are not running that function.. you are instantiating a new instance of sql which is invoking the object's constructor. > > echo "db" = .$db; > ---------------------------------------- > > $db comes back as an object id.. even when i force a 'return false'. it > appears that no matter what i do, the class constructor returns an object > id!!! the weird thing is that it gets to the 'return false' and then still > seems to return the 'object id' i've also replaced 'false' with other > values to see if it made a diff.. it didn't which is good... i would have > really hit the roof then!! > > so.. why is this behavior occuring. > > any ideas as to why? > > or, am i just too tired right now! > > thanks > > bruce > > ps.. i could use the $db, object ID, and try to see if it actually access > the db, in order to determine if it actually exists. but i shouldn't have > to do that... the class should return false!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php