Welcome Guest, Not a member yet? Register   Sign In
How to call a method in the same class?
#2

[eluser]mikelbring[/eluser]
I am not 100% sure what your trying to accomplish, but it sounds like you need to define a variable in the class and then modify it in a function and then use it in another function for example:

Code:
class myclass{
    public $var;
    
    function myFunction(){
        $this->varr ='my variable';
    }
    
    function printVar(){
        echo $this->varr;
    }

}

I hope that is what you are looking for.

Note using "public" is php5.x, use "var" if you are on anything less.


Messages In This Thread
How to call a method in the same class? - by El Forum - 02-16-2010, 12:16 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 12:21 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 12:22 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 12:25 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 12:27 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 12:37 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 12:39 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 12:50 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 12:53 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 01:01 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 02:15 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 02:23 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 04:56 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 05:43 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 06:02 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 06:27 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 08:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB