static classes and methods

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I may have more of a design problem, but here goes.

I have a class that has 3 methods. One method simply calls the other
two. I wanted to make the class static, and to do this in php, you
just have to make the function static. So I did that for all three
functions. But now I cannot call the other two functions from the
first function.

What do I need to do to make the one function in the class call the
other 2. The only way I know right now, is to not make any of the
functions static.

Re: static classes and methods


Quoted text here. Click to load it


class foo{
    static function bar(){
    static function foz(){echo 'hello';}
    static function baz(){echo ', world';}
Rik Wasmus

Re: static classes and methods

Quoted text here. Click to load it

Thanks you very much Rik. I have a follow up. Let say in my class, I
would like to include a properties file:
require_once ''; // has a value called $var_from_file in

I would like to use a value from this file.
static function foz(){echo $var_from_file;}

How would I do that?

Site Timeline