Ya i actually got it working yesterday thanks to Matt who sent me some sample class code to execute. I put it in a seperate file and it worked fine. So thin i put the class i was trying to call in a seperate class as well and that did it. ie., the problem(besides all the ones you mentioned) was that i had included the class along with other non-class code in the same file. When i tried to call it from another file using the inlcude_once function the other code was trying to execute as well...
cheers


Paul






From: Neil Smith <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re:Subject: Need Help with Classes
Date: Thu, 13 Feb 2003 13:02:32 +0000

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

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail


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

Reply via email to