admin管理员组

文章数量:1406042

i want to call myfunction() inside the myfunction2() how can i achieve that. can you give me an example.

class myclass(){

  function myfunction(){
  #my code here
  }

}


function myfunction2(){
# how can i get the function myfunction() here.
}

i want to call myfunction() inside the myfunction2() how can i achieve that. can you give me an example.

class myclass(){

  function myfunction(){
  #my code here
  }

}


function myfunction2(){
# how can i get the function myfunction() here.
}
Share Improve this question asked Nov 27, 2019 at 8:50 Jhonray AngconJhonray Angcon 32 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Remove the () after myclass. Then in your myfunction2:

$obj = new myclass();
$obj->myfunction();

本文标签: pluginsHow to call a function from inside class to outside class