Jump to content

php class extending


strazdinjsh

Recommended Posts

could anyone advice how to extend the php class who contains variable?  sample below does not work.

 

 

class test1 extends test2($index){

                          public function output($index){
                          echo $index;
                          }
}

class test2{

	         public function __construct($index){
	         echo $index;
	         }
}



$test = new test1;
$test->output('My Test2');
$test->test2('My Test1');

Link to comment
https://forums.phpfreaks.com/topic/233063-php-class-extending/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.