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; } } functinon __(){ 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 5.4.0 - 5.5.1
Parse error: syntax error, unexpected '__' (T_STRING) in /in/RFWrG on line 31
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_STRING in /in/RFWrG on line 31
Process exited with code 255.