3v4l.org

run code in 300+ PHP versions simultaneously
<?php class string { protected $_string; public function __construct($string) { if(is_string($string)) $this->_string = $string; elseif(is_int($string)) $this->_string = $this->intToAscii($string); else $this->_string = null; echo('Error, string::__construct() argument 1 must be a string!'); } public function __toString() { return $this->_string; } public function ascii() { $code = ''; if(strlen($this->_string)==1) return ord($this->_string); else for($i = 0; $i < strlen($this->_string); $i++) { $code .= ord($this->_string[$i]); } return $code; } }
Output for 7.0.0
Fatal error: Cannot use 'string' as class name as it is reserved in /in/PHpYj on line 2
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.28

preferences:
189.26 ms | 1399 KiB | 73 Q