Re:Subject: Need Help with Classes
| From: | Neil Smith | Date: | Thu, 13 Feb 2003 13:02:32 +0000 |
| Subject: | Re:Subject: Need Help with Classes | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-18523@lists.php.net to get a copy of this message | ||
I thought PHP worked like this : to instantiate a class, you need to name a constructor function with the same name as your class. Also var myVar should be var $myVar -- I think setting myVar will create a constant not a variable. Try turning error_reporting(E_ALL) on in your code to catch this sort of error :
class myClass
{
var $myVar;
var $myVarA;
var $myVarB
function myClass($myVarA,$myVarB)
{
....
$this -> myVar = array("b" => 55,"c" => 66);
}} That *should* work. No warranty express or implied etc etc lol Cheers, Neil Smith. At 02:23 13/02/2003 +0000, you wrote: Subject: Need Help with Classes
Ya it seems like a pain indeed. I guess i'll pose the question though: for the following class class myClass { var myVar; function myFunc($myVarA,$myVarB) { .... $this -> myVar = array("b" => 55,"c" => 66); } } Now i try $somveVar = new myClass(); and finally i try and acces myVar from outside the class: $x = ($someVar->$myVar["u"]); $y = ($someVar->$myVar["v"]); Nada, rien, nicht, no dice... Any help would be appreciated, Paul