3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class UString { private $string = null; public function __construct(string $string) { $this->string = $string; } } echo strlen(new Ustring('Class with __string method !'));
Output for 7.0.0 - 7.2.0
Warning: strlen() expects parameter 1 to be string, object given in /in/5RNUM on line 13
Output for 5.3.18 - 5.6.28
Catchable fatal error: Argument 1 passed to UString::__construct() must be an instance of string, string given, called in /in/5RNUM on line 13 and defined in /in/5RNUM on line 7
Process exited with code 255.