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

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to