3v4l.org

run code in 300+ PHP versions simultaneously
<?php class tokenstream { // Входной поток private $input_stream; // Указатель позиции во входном потоке public $seek = 0; // Конструктор public function __construct ( $input ) { // Инициализируем входной поток $this -> input_stream = $input; } // Возвращает очередной символ из входного потока public function readChar ( ) { $char = ( isset ( $this -> input_stream [ $this -> seek ] ) ? $this -> input_stream [ $this -> seek ] : false ); $this -> seek++; return $char; } // Производит токенизацию public function tokenize ( ) { $output = array ( ); while ( ( $char = $this -> readChar ( ) ) !== false ) { if ( preg_match ( '/\s/', $char ) ) { // Неотображаемые символы } elseif ( preg_match ( '/\"/', $char ) ) { // Кавычки $output [ ] = 'T_QUOTE'; } return $output; } } // Исходный код для разбора $my_source = ' function foo ( ) { $my_var = "foo-bar"; } '; // Создаем экземпляр класса парсера $tokenstream = new tokenstream ( $my_source ); // Парсим исходный код и распечатываем результат print_r ( $tokenstream -> tokenize ( ) );

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.140.0090.04212.08
5.4.130.0060.04312.06
5.4.120.0070.04812.03
5.4.110.0090.04312.02
5.4.100.0080.03812.02
5.4.90.0080.04612.03
5.4.80.0090.04712.02
5.4.70.0100.04612.02
5.4.60.0090.04812.02
5.4.50.0080.04612.02
5.4.40.0080.04012.01
5.4.30.0120.04212.01
5.4.20.0090.03512.00
5.4.10.0070.04312.00
5.4.00.0080.04711.50
5.3.240.0100.05512.72
5.3.230.0110.05012.71
5.3.220.0080.04812.68
5.3.210.0100.04812.68
5.3.200.0080.04112.68
5.3.190.0100.04112.67
5.3.180.0090.04412.67
5.3.170.0080.04412.67
5.3.160.0090.03912.67
5.3.150.0100.03612.67
5.3.140.0090.04112.66
5.3.130.0070.04512.66
5.3.120.0070.04712.66
5.3.110.0100.04912.66
5.3.100.0090.05712.13
5.3.90.0070.04912.10
5.3.80.0120.05512.09
5.3.70.0090.04712.09
5.3.60.0090.04812.08
5.3.50.0070.04012.02
5.3.40.0070.03812.02
5.3.30.0080.03711.98
5.3.20.0090.04211.76
5.3.10.0090.04511.73
5.3.00.0090.04211.71

preferences:
136.29 ms | 1398 KiB | 7 Q