Привет!

<?php
class a {
   function test() {
     return 1;
   }
}

class b {
   function test() {
     return 2;
   }
}

$myclass = 'a';
echo $myclass::test();
?>

This will not work. It will produce in instead a:
parse error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting ',' or ';'

Funnily enough, the NEKUDOTA part looks slavian (sort of "nowhereToGo", 
not russian, maybe it's polish), so I suspect it means it cannot resolve 
a parametrized call. It might be a coincidence.

Everything else *does* support calling class methods by dynamically 
referencing a class name. For those working with plugins this a 
*serious* minus. Right now I found a way not to need the call, but 
please let me know if you ever met this thing.

For those who aren't into OOPHP the :: operator is supposed to execute a 
function call on a class, instead of doing it on an instance. So you do 
not need to create an instance and can use a class as a normal library 
when you need to do so. But this way your plugin classes cannot be used 
as libraries.

Static calls like a::test() or b::test() will work as expected.

пока
Альберто
Киев

@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@

LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu?
lOrD i'M sHiNiNg...
YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is.......


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

Reply via email to