3v4l.org

run code in 300+ PHP versions simultaneously
<?php class interpreter { private $_code; public function __construct($code) { if(!is_string($code)) exit('Error while parsing code; Code not conformal.'); $this->_code = $code; $this->exec(); } public function parser($code = null) { $array = []; if($code === null) $code = $this->_code; if(preg_match('#print\((.*)\)#', $code, $array)) echo($array[1]); } } $code = 'print("Hello World!");'; $program = new interpreter($code);

preferences:
38.98 ms | 402 KiB | 5 Q