3v4l.org

run code in 300+ PHP versions simultaneously
<?php $code = <<<CODE require_once 'config.php'; require_once 'startup.php'; //TODO: Добавить очистку массивов POST и GET $input = new Input; $session = new Session; $cookie = new Cookie; $user = User::getInstance(); //test - admin is permanently logged in $session->set('hash', '06260034fa0ac9fef81991f93abf2db3'); //test $hash = $session->get('hash') ? $session->get('hash') : $cookie->get('hash'); $user->fetchOneByHash($hash); //Запускаем action, в зависимости от того, что пришло в POST if($_SERVER['REQUEST_METHOD'] == 'POST') { /** * Записываем в текущую историю то, что пришло из POST['text'] * (пользователь мог изменить предыдущий результат в поле ввода текста вручную) * Если же история пуста, произойдет инициализация сессии с историей - * в сессию в $_SESSION[category][0][text] запишется POST['text'] */ $history = History::getInstance(History::CURRENT_RECORD); $history->set('text', $input->post('text')); $history->destroyInstance(); $route = $input->post('action') ? $input->post('action') : 'editor/editor/index/'; } else { $route = $input->get('route') ? $input->get('route') : 'editor/editor/index/' . $input->get('category'); } $action = new Action($route); $action->execute(); CODE; preg_match_all('~(?(DEFINE) (?<comment> (?&line_comment) | (?&block_comment)) (?<line_comment> (?&slash_comment) | (?&hash_comment)) (?<slash_comment> //.*) (?<hash_comment> #.*) (?<block_comment> (?s)/\*.*?\*/) ) (?&comment)~x', $code, $matches); print_r($matches);
Output for 5.4.0 - 5.4.11
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in PBZ6B on line 24
Process exited with code 255.
Output for 5.3.0 - 5.3.21
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in PBZ6B on line 24
Process exited with code 255.

preferences:
177.89 ms | 1395 KiB | 41 Q