note 46307 added to language.oop5.overloading

From: Date: Wed, 06 Oct 2004 14:40:58 +0000
Subject: note 46307 added to language.oop5.overloading
Groups: php.notes 
Request: Send a blank email to php-notes+get-78067@lists.php.net to get a copy of this message
A few things I've found about __get()... First off, if you use $obj->getOne->getAnother, both intended to be resolved by __get, the __get() function only sees the first one at first. You can't access the second one. You can, however, return the pointer to an object that can handle the second one. In short, you can have the same class handle both by returning a new object with the data changed however you see fit. Secondly, when using arrays like: $obj->getArray["one"], only the array name is passed on to __get. However, when you return the array, PHP treats it just as it should. THat is, you'd have to make an array with the index of "one" in __get in order to see any results. You can also have other indexes in there as well. Also, for those of you like me, I've already tried to use func_get_args to see if you can get more than just that one. If you're like me and were hoping you could pass some sort of argument onto __get in order to help gather the correct data, you're out of look. I do recommend using __call though. You could easily rig __call up to react to certain things, like: $account->properties( "type" );, which is my example. I'm using DOM for data storage (for now), and I'm trying to make an interface that'll let me easily switch to something else - MySQL, flat file, anything. This would work great though! Hope I've been helpful and I hope I didn't restate something already stated. ---- Manual Page -- http://www.php.net/manual/en/language.oop5.overloading.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46307 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46307&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+46307&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#78067) next »