3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace API; class a { function foo() { echo "ello!"; $this->calling(); } function calling() { echo "I'm calling from a"; } } class b extends a { function foo() { $this->calling(); // This's the mistakes.. $this->anotherOne(); public function calling() { echo "I'm calling from B!"; } function anotherOne() { echo "aaaaa"; } } } $tryMe = new \API\b(); $tryMe->foo();
Output for 7.1.0 - 7.1.19, 7.2.0 - 7.2.8
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /in/cseFa on line 22
Process exited with code 255.

preferences:
174.83 ms | 1395 KiB | 36 Q