Re: PHP 4 to 5 class issues involving static methods and $this

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

 



Chris wrote:
How can I rewrite my class for PHP 5 to emulate the functionality I had in PHP 4 in an error free way?

Have you tried this:

function format_string($string) {
    // format the string...
    $result = string;
    if (isset($this)) $this->elements[] = $result;
    return $result;
}

In this form you can check the existance of $this. If you call the method statically then $this is not present and the elements array is not filled. If you call it non-statically then $this is present and elements is filled. The same you can do with show_all().

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


[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