Welcome Guest, Not a member yet? Register   Sign In
Can i define a function within a funciton and call it from another function i the same class?
#1

[eluser]coldscooter[/eluser]
I want to do something like this in CI:

class myclass(){

function __contruct(){
function test1();
}

public function test1(){
function test2(){
echo 'in function';
}
}

public function test3(){
this->test2();
}

}

So i want to be able to access test2() from within test3(). Is this possible?
#2

[eluser]Aken[/eluser]
Procedural functions defined inside of class methods are not ideal. What are you trying to accomplish?
#3

[eluser]coldscooter[/eluser]
Don't worry, the way i did it actually worked a treat. Sorry shouldn't have been so hasty with my post.




Theme © iAndrew 2016 - Forum software by © MyBB