3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $code = <<<EOP <?php function extractURL($url) { if (preg_match('#http://www.google.com/?$#i', $url, $match)) { return $match[1]; } return null; } EOP; $tokens = token_get_all($code); foreach ($tokens as $token) { if (is_string($token)) { print "[(string)] " . $token . "\r\n"; } else { print "[" . token_name($token[0]) . "] " . $token[1] . "\r\n"; } }
Output for 7.0.0 - 7.1.0
Notice: Undefined variable: url in /in/NJTIC on line 4 Notice: Undefined variable: url in /in/NJTIC on line 6 Notice: Undefined variable: match in /in/NJTIC on line 6 Notice: Undefined variable: match in /in/NJTIC on line 7 [T_OPEN_TAG] <?php [T_FUNCTION] function [T_WHITESPACE] [T_STRING] extractURL [(string)] ( [(string)] ) [T_WHITESPACE] [(string)] { [T_WHITESPACE] [T_IF] if [T_WHITESPACE] [(string)] ( [T_STRING] preg_match [(string)] ( [T_CONSTANT_ENCAPSED_STRING] '#http://www.google.com/?$#i' [(string)] , [T_WHITESPACE] [(string)] , [T_WHITESPACE] [(string)] ) [(string)] ) [T_WHITESPACE] [(string)] { [T_WHITESPACE] [T_RETURN] return [T_WHITESPACE] [(string)] ; [T_WHITESPACE] [(string)] } [T_WHITESPACE] [T_RETURN] return [T_WHITESPACE] [T_STRING] null [(string)] ; [T_WHITESPACE] [(string)] }
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: url in /in/NJTIC on line 11 Notice: Undefined variable: url in /in/NJTIC on line 11 Notice: Undefined variable: match in /in/NJTIC on line 11 Notice: Undefined variable: match in /in/NJTIC on line 7 [T_OPEN_TAG] <?php [T_FUNCTION] function [T_WHITESPACE] [T_STRING] extractURL [(string)] ( [(string)] ) [T_WHITESPACE] [(string)] { [T_WHITESPACE] [T_IF] if [T_WHITESPACE] [(string)] ( [T_STRING] preg_match [(string)] ( [T_CONSTANT_ENCAPSED_STRING] '#http://www.google.com/?$#i' [(string)] , [T_WHITESPACE] [(string)] , [T_WHITESPACE] [(string)] ) [(string)] ) [T_WHITESPACE] [(string)] { [T_WHITESPACE] [T_RETURN] return [T_WHITESPACE] [(string)] ; [T_WHITESPACE] [(string)] } [T_WHITESPACE] [T_RETURN] return [T_WHITESPACE] [T_STRING] null [(string)] ; [T_WHITESPACE] [(string)] }
Output for 5.2.3 - 5.6.28
Notice: Undefined variable: url in /in/NJTIC on line 6 Notice: Undefined variable: url in /in/NJTIC on line 6 Notice: Undefined variable: match in /in/NJTIC on line 7 Notice: Undefined variable: match in /in/NJTIC on line 7 [T_OPEN_TAG] <?php [T_FUNCTION] function [T_WHITESPACE] [T_STRING] extractURL [(string)] ( [(string)] ) [T_WHITESPACE] [(string)] { [T_WHITESPACE] [T_IF] if [T_WHITESPACE] [(string)] ( [T_STRING] preg_match [(string)] ( [T_CONSTANT_ENCAPSED_STRING] '#http://www.google.com/?$#i' [(string)] , [T_WHITESPACE] [(string)] , [T_WHITESPACE] [(string)] ) [(string)] ) [T_WHITESPACE] [(string)] { [T_WHITESPACE] [T_RETURN] return [T_WHITESPACE] [(string)] ; [T_WHITESPACE] [(string)] } [T_WHITESPACE] [T_RETURN] return [T_WHITESPACE] [T_STRING] null [(string)] ; [T_WHITESPACE] [(string)] }
Output for 5.0.4 - 5.2.2
Notice: Undefined variable: url in /in/NJTIC on line 5 Notice: Undefined variable: url in /in/NJTIC on line 6 Notice: Undefined variable: match in /in/NJTIC on line 6 Notice: Undefined variable: match in /in/NJTIC on line 7 [T_OPEN_TAG] <?php [T_FUNCTION] function [T_WHITESPACE] [T_STRING] extractURL [(string)] ( [(string)] ) [T_WHITESPACE] [(string)] { [T_WHITESPACE] [T_IF] if [T_WHITESPACE] [(string)] ( [T_STRING] preg_match [(string)] ( [T_CONSTANT_ENCAPSED_STRING] '#http://www.google.com/?$#i' [(string)] , [T_WHITESPACE] [(string)] , [T_WHITESPACE] [(string)] ) [(string)] ) [T_WHITESPACE] [(string)] { [T_WHITESPACE] [T_RETURN] return [T_WHITESPACE] [(string)] ; [T_WHITESPACE] [(string)] } [T_WHITESPACE] [T_RETURN] return [T_WHITESPACE] [T_STRING] null [(string)] ; [T_WHITESPACE] [(string)] }
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: url in /in/NJTIC on line 5 Notice: Undefined variable: url in /in/NJTIC on line 6 Notice: Undefined variable: match in /in/NJTIC on line 6 Notice: Undefined variable: match in /in/NJTIC on line 7 [T_OPEN_TAG] <?php [T_FUNCTION] function [T_WHITESPACE] [T_STRING] extractURL [(string)] ( [(string)] ) [T_WHITESPACE] [(string)] { [T_WHITESPACE] [T_IF] if [T_WHITESPACE] [(string)] ( [T_STRING] preg_match [(string)] ( [T_CONSTANT_ENCAPSED_STRING] '#http://www.google.com/?$#i' [(string)] , [T_WHITESPACE] [(string)] , [T_WHITESPACE] [(string)] ) [(string)] ) [T_WHITESPACE] [(string)] { [T_WHITESPACE] [T_RETURN] return [T_WHITESPACE] [(string)] ; [T_WHITESPACE] [(string)] } [T_WHITESPACE] [T_RETURN] return [T_WHITESPACE] [T_STRING] null [(string)] ; [T_WHITESPACE] [(string)] }