3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Phrase { public function __construct($text, array $arguments = array()) { $this->_text = (string)$text; $this->_arguments = $arguments; } public function __toString() { return $this->render($this->_text, $this->_arguments); } public function render($text, array $arguments) { if ($arguments) { $placeholders = array(); for ($i = 1, $size = count($arguments); $i <= $size; $i++) { $placeholders[] = "%$i"; } $text = str_replace($placeholders, $arguments, $text); } return $text; } } function __(){ return new Phrase(func_get_arguments()); } echo __('sdgsa gsag sg %1 gas g%2 w4', 1111,222) ,'<br>'; echo __('sdgsa gsag sg %1 gas g%2 w4', 1111) ,'<br>';
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function func_get_arguments() in /in/K2ivM:32 Stack trace: #0 /in/K2ivM(35): __('sdgsa gsag sg %...', 1111, 222) #1 {main} thrown in /in/K2ivM on line 32
Process exited with code 255.
Output for 5.1.0 - 5.6.28
Fatal error: Call to undefined function func_get_arguments() in /in/K2ivM on line 32
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_ARRAY, expecting '&' or T_VARIABLE in /in/K2ivM on line 5
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/K2ivM on line 5
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, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/K2ivM on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/K2ivM on line 5
Process exited with code 255.