3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Test { protected $url; public function __construct(string $url = null) { $this->url = $url; } public function url() : string { return $this->url; } } $test = new Test(null); echo $test->url();
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Return value of Test::url() must be of the type string, null returned in /in/WVrvU:10 Stack trace: #0 /in/WVrvU(16): Test->url() #1 {main} thrown in /in/WVrvU on line 10
Process exited with code 255.
Output for 5.3.21 - 5.6.21
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/WVrvU on line 9
Process exited with code 255.