3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface SlugifierInterface { /** * Return a URL safe version of a string. * * @param string $string * @return string */ public function slugify($string); } class Sluggifier implements SlugifierInterface { public function __construct() { } /* public function slugify($string) { return "I am from" . $string; } */ public function slugify($string) { return "I am from static " . $string; } } echo Sluggifier::slugify("Hello World") . PHP_EOL; $sluggifier = new Sluggifier(); echo $sluggifier->slugify("Hello World from object") . PHP_EOL;
Output for 7.0.0 - 7.2.6
Deprecated: Non-static method Sluggifier::slugify() should not be called statically in /in/ZX9BV on line 30 I am from static Hello World I am from static Hello World from object
Output for 5.0.2 - 5.6.28
Strict Standards: Non-static method Sluggifier::slugify() should not be called statically in /in/ZX9BV on line 30 I am from static Hello World I am from static Hello World from object
Output for 5.0.0 - 5.0.1
Strict Standards: Non-static method Sluggifier::slugify() should not be called statically in /in/ZX9BV on line 30 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ZX9BV on line 30 I am from static Hello WorldPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ZX9BV on line 32 I am from static Hello World from objectPHP_EOL
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING in /in/ZX9BV on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING in /in/ZX9BV on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/ZX9BV on line 2
Process exited with code 255.