Page 1 of 1

cannot recognize class

Posted: Sat Jun 04, 2005 6:05 pm
by The_Percival
I get the error : "Fatal error: Cannot instantiate non-existent class".

I call :
$Languages = $FootballEye->GetLanguages();

$FootballEye is known is no problem!

$FootballEye.php:
include("Language.php");

class FootballEye
{
...

function GetLanguages()
{
this->$Languages = new $Languages();

}

Now $Languages is not known while I include Language.php in the top of file $FootballEye.php.

Has anybody an idea? Can I use new in a class?

Why does this not work?

Thanks in advance!

Coen Dunnink
The Netherlands

Posted: Sat Jun 04, 2005 7:30 pm
by Skara
put the class before you include the language file. :/

Why should I include the language file at all then?

Posted: Sun Jun 05, 2005 5:21 am
by The_Percival
Why should I include the language file at all then?

Posted: Sun Jun 05, 2005 5:40 am
by anjanesh

Code: Select all

$fb = new FootballEye();
$Languages = $fb->GetLanguages();
In your method GetLanguages(), are you not returning anything ?
$this->Languages not this->$Languages - slightly different from C++ Class.

Code: Select all

function GetLanguages()
{
 $this->Languages = new $Languages();
 // return $this->Languages->something();
}