3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $code = "<?php namespace Test; class TestClass { } "; $tokens = token_get_all($code); $count = count($tokens); for($i = 0; $i < $count; $i++) { echo token_name($tokens[$i][0]); echo "|"; echo $tokens[$i][0]; echo "|"; echo $tokens[$i][1]; echo "|"; echo $tokens[$i][2]; echo "\n"; }
based on 2dv3b
Output for 7.0.0 - 7.2.0
T_OPEN_TAG|379|<?php |1 T_WHITESPACE|382| |2 T_NAMESPACE|388|namespace|3 T_WHITESPACE|382| |3 T_STRING|319|Test|3 Warning: token_name() expects parameter 1 to be integer, string given in /in/vNkBh on line 17 |;| Notice: Uninitialized string offset: 1 in /in/vNkBh on line 21 | Notice: Uninitialized string offset: 2 in /in/vNkBh on line 23 T_WHITESPACE|382| |3 T_CLASS|361|class|5 T_WHITESPACE|382| |5 T_STRING|319|TestClass|5 T_WHITESPACE|382| |5 Warning: token_name() expects parameter 1 to be integer, string given in /in/vNkBh on line 17 |{| Notice: Uninitialized string offset: 1 in /in/vNkBh on line 21 | Notice: Uninitialized string offset: 2 in /in/vNkBh on line 23 T_WHITESPACE|382| |5 Warning: token_name() expects parameter 1 to be integer, string given in /in/vNkBh on line 17 |}| Notice: Uninitialized string offset: 1 in /in/vNkBh on line 21 | Notice: Uninitialized string offset: 2 in /in/vNkBh on line 23 T_WHITESPACE|382| |7
Output for 5.6.8 - 5.6.28
T_OPEN_TAG|376|<?php |1 T_WHITESPACE|379| |2 T_NAMESPACE|385|namespace|3 T_WHITESPACE|379| |3 T_STRING|310|Test|3 Warning: token_name() expects parameter 1 to be long, string given in /in/vNkBh on line 17 |;| Notice: Uninitialized string offset: 1 in /in/vNkBh on line 21 | Notice: Uninitialized string offset: 2 in /in/vNkBh on line 23 T_WHITESPACE|379| |3 T_CLASS|358|class|5 T_WHITESPACE|379| |5 T_STRING|310|TestClass|5 T_WHITESPACE|379| |5 Warning: token_name() expects parameter 1 to be long, string given in /in/vNkBh on line 17 |{| Notice: Uninitialized string offset: 1 in /in/vNkBh on line 21 | Notice: Uninitialized string offset: 2 in /in/vNkBh on line 23 T_WHITESPACE|379| |5 Warning: token_name() expects parameter 1 to be long, string given in /in/vNkBh on line 17 |}| Notice: Uninitialized string offset: 1 in /in/vNkBh on line 21 | Notice: Uninitialized string offset: 2 in /in/vNkBh on line 23 T_WHITESPACE|379| |7
Output for 5.5.24 - 5.5.35
T_OPEN_TAG|374|<?php |1 T_WHITESPACE|377| |2 T_NAMESPACE|383|namespace|3 T_WHITESPACE|377| |3 T_STRING|308|Test|3 Warning: token_name() expects parameter 1 to be long, string given in /in/vNkBh on line 17 |;| Notice: Uninitialized string offset: 1 in /in/vNkBh on line 21 | Notice: Uninitialized string offset: 2 in /in/vNkBh on line 23 T_WHITESPACE|377| |3 T_CLASS|356|class|5 T_WHITESPACE|377| |5 T_STRING|308|TestClass|5 T_WHITESPACE|377| |5 Warning: token_name() expects parameter 1 to be long, string given in /in/vNkBh on line 17 |{| Notice: Uninitialized string offset: 1 in /in/vNkBh on line 21 | Notice: Uninitialized string offset: 2 in /in/vNkBh on line 23 T_WHITESPACE|377| |5 Warning: token_name() expects parameter 1 to be long, string given in /in/vNkBh on line 17 |}| Notice: Uninitialized string offset: 1 in /in/vNkBh on line 21 | Notice: Uninitialized string offset: 2 in /in/vNkBh on line 23 T_WHITESPACE|377| |7
Output for 5.4.7 - 5.4.45
T_OPEN_TAG|372|<?php |1 T_WHITESPACE|375| |2 T_NAMESPACE|381|namespace|3 T_WHITESPACE|375| |3 T_STRING|307|Test|3 Warning: token_name() expects parameter 1 to be long, string given in /in/vNkBh on line 17 |;| Notice: Uninitialized string offset: 1 in /in/vNkBh on line 21 | Notice: Uninitialized string offset: 2 in /in/vNkBh on line 23 T_WHITESPACE|375| |3 T_CLASS|354|class|5 T_WHITESPACE|375| |5 T_STRING|307|TestClass|5 T_WHITESPACE|375| |5 Warning: token_name() expects parameter 1 to be long, string given in /in/vNkBh on line 17 |{| Notice: Uninitialized string offset: 1 in /in/vNkBh on line 21 | Notice: Uninitialized string offset: 2 in /in/vNkBh on line 23 T_WHITESPACE|375| |5 Warning: token_name() expects parameter 1 to be long, string given in /in/vNkBh on line 17 |}| Notice: Uninitialized string offset: 1 in /in/vNkBh on line 21 | Notice: Uninitialized string offset: 2 in /in/vNkBh on line 23 T_WHITESPACE|375| |7
Output for 5.3.17 - 5.3.29
T_OPEN_TAG|368|<?php |1 T_WHITESPACE|371| |2 T_NAMESPACE|377|namespace|3 T_WHITESPACE|371| |3 T_STRING|307|Test|3 Warning: token_name() expects parameter 1 to be long, string given in /in/vNkBh on line 17 |;| Notice: Uninitialized string offset: 1 in /in/vNkBh on line 21 | Notice: Uninitialized string offset: 2 in /in/vNkBh on line 23 T_WHITESPACE|371| |3 T_CLASS|353|class|5 T_WHITESPACE|371| |5 T_STRING|307|TestClass|5 T_WHITESPACE|371| |5 Warning: token_name() expects parameter 1 to be long, string given in /in/vNkBh on line 17 |{| Notice: Uninitialized string offset: 1 in /in/vNkBh on line 21 | Notice: Uninitialized string offset: 2 in /in/vNkBh on line 23 T_WHITESPACE|371| |5 Warning: token_name() expects parameter 1 to be long, string given in /in/vNkBh on line 17 |}| Notice: Uninitialized string offset: 1 in /in/vNkBh on line 21 | Notice: Uninitialized string offset: 2 in /in/vNkBh on line 23 T_WHITESPACE|371| |7