3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php /** * Enhancement to Zend_Locale class with added support for codeset and modifier. */ class Zefram_Locale { /** * @var string */ protected $_codeset; /** * @var modifier */ protected $_modifier; /** * Sets a new locale, see {@see Zend_Locale::setLocale()}. * * @param @param string|Zend_Locale $locale OPTIONAL * @return void */ public function setLocale($locale = null) { $codeset = null; $modifier = null; if ($locale instanceof Zefram_Locale) { $codeset = $locale->getCodeset(); } else { // POSIX locale format: [language[_territory][.codeset][@modifier]] // http://en.wikipedia.org/wiki/Locale @list($locale, $codeset) = explode('.', $locale, 2); @list($codeset, $modifier) = explode('@', $codeset, 2); } parent::setLocale($locale); $this->_codeset = $codeset; $this->_modifier = $modifier; } /** * @return string */ public function getCodeset() { return $this->_codeset; } /** * @return string */ public function getModifier() { return $this->_modifier; } /** * @return string */ public function toString() { $locale = parent::toString(); if ($this->_codeset) { $locale .= '.' . $this->_codeset; } if ($this->_modifier) { $locale .= '@' . $this->_modifier; } return $locale; } }
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
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/0Yr6V on line 11
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/0Yr6V on line 11
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/0Yr6V on line 11
Process exited with code 255.