0

I have class

class a{
     var $test;
}

I have lots of functions in files. Each file having its own function like

File1.php contains function File1(){}

There are 50+ files for function. I want to dynamically add onliy one function at runtime, So that final class structure like this

class a{
var $test;
function File1(){
}
}
Manoj Rathore
  • 127
  • 1
  • 14
  • [This has already been asked before](http://stackoverflow.com/questions/3011910/how-to-add-a-method-to-an-existing-class-in-php) – php_nub_qq Jun 01 '13 at 10:30
  • Yes but in the question, We can extend the function with closure but we cant modify the variables of class with closure defination.. – Manoj Rathore Jun 01 '13 at 10:33
  • why would you want to do that in the first place? Point being why not just add all the methods you need? – php_nub_qq Jun 01 '13 at 10:41
  • also see http://stackoverflow.com/questions/4535330/calling-closure-assigned-to-object-property-directly – Gordon Jun 01 '13 at 10:46

0 Answers0