Re: Function variables in classes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/1/07, Eric Butera <eric.butera@xxxxxxxxx> wrote:
>
> I don't know if this has been said yet, but in 5.3 they added this:
> Dynamic static calls: $c = "classname"; $c::someMetod();



apparently it works in 5.2.4 as well:

<?php
class Foo {
    static public function staticMethod() {
        echo __METHOD__ . PHP_EOL;
    }

    public function nonStaticMethod() {
        echo __METHOD__ . PHP_EOL;
    }
}

$fooStr = 'Foo';
$fooStr::staticMethod();
Foo::staticMethod();
Foo::nonstaticMethod();
$foo = new Foo();
$foo->staticMethod();
$foo->nonstaticMethod();
?>

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux