Posts Tagged ‘methods’

How to access variables or methods of the parent class in php

use the double colon(::) and parent keyword to access the variables or methods of the parent class in php

  1. class myparent {
  2. function myfunction() {
  3. echo "parent method";
  4. }
  5. }
  6.  
  7. class mychild extends myparent {
  8. function myfunc()[
  9. parent::myfunction();
  10. }
  11. }

, , , ,

No Comments



SetPageWidth