Run ❯
Get your
own PHP
server
Result Size:
625 x 565
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <?php class MyClass { protected $number = 0; } class AnotherClass extends MyClass { public function add1() { $this->number++; } public function getNumber() { return $this->number; } } $obj = new AnotherClass(); $obj->add1(); echo "The number is " . $obj->getNumber(); ?> </body> </html>
The number is 1