[PHP] Class operator :: Problem

2002-09-03 Thread Unger, Christian

I have problems to make a dynamic call, please help me

?
class a {
  function test() {
 echo Hallo;
  }
}

$testfunct = a::test;

$testfunct();

?

returns:
Fatal error: Call to undefined function: a::test() in
/usr/local/share/version2.mypsi.de/index.html on line 10

---
Christian Unger
IT-Consultant

PSI Infrastruktur Services GmbH
Dircksenstr. 42-44
10178 Berlin

Tel: 030 / 2801 - 2536
Fax: 030 / 2801 - 297 2536
e-Mail: [EMAIL PROTECTED]


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




RE: [PHP] Class operator :: Problem

2002-09-03 Thread Scott Houseman

Hi There

Try doing it this way:

?
class a {
  function test() {
 echo Hallo;
  }
}

$testfunct = a::test();;

eval($testfunct);

?

Regards
-|Scott

 -Original Message-
 From: Unger, Christian [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, September 03, 2002 2:51 PM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP] Class operator :: Problem
 
 
 I have problems to make a dynamic call, please help me
 
 ?
 class a {
   function test() {
  echo Hallo;
   }
 }
 
 $testfunct = a::test;
 
 $testfunct();
 
 ?
 
 returns:
 Fatal error: Call to undefined function: a::test() in
 /usr/local/share/version2.mypsi.de/index.html on line 10
 
 ---
 Christian Unger
 IT-Consultant
 
 PSI Infrastruktur Services GmbH
 Dircksenstr. 42-44
 10178 Berlin
 
 Tel: 030 / 2801 - 2536
 Fax: 030 / 2801 - 297 2536
 e-Mail: [EMAIL PROTECTED]
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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




[PHP] Class operator :: Problem

2002-09-03 Thread Javier Montserat

?
class a {
  function test() {
 echo Hallo;
  }
}

$testfunct = a::test();
$testfunct;
?

i think because you assign a method to the variable rather than a data 
member you need to include parenthsis...

a::test()




I have problems to make a dynamic call, please help me

?
class a {
  function test() {
 echo Hallo;
  }
}

$testfunct = a::test;

$testfunct();

?

returns:
Fatal error: Call to undefined function: a::test() in
/usr/local/share/version2.mypsi.de/index.html on line 10

---
Christian Unger
IT-Consultant

PSI Infrastruktur Services GmbH
Dircksenstr. 42-44
10178 Berlin

Tel: 030 / 2801 - 2536
Fax: 030 / 2801 - 297 2536
e-Mail: [EMAIL PROTECTED]



_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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




Re: [PHP] Class operator :: Problem

2002-09-03 Thread Marek Kilimajer

Try a helper function

function helper() {
return a::test();
}

$testfunct = helper;

...

Unger, Christian wrote:

I have problems to make a dynamic call, please help me

?
class a {
  function test() {
 echo Hallo;
  }
}

$testfunct = a::test;

$testfunct();

?

returns:
Fatal error: Call to undefined function: a::test() in
/usr/local/share/version2.mypsi.de/index.html on line 10

---
Christian Unger
IT-Consultant

PSI Infrastruktur Services GmbH
Dircksenstr. 42-44
10178 Berlin

Tel: 030 / 2801 - 2536
Fax: 030 / 2801 - 297 2536
e-Mail: [EMAIL PROTECTED]


  



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