3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $tokens = token_get_all('<?php $a = 1 + 2; echo $a ?>'); var_dump($tokens); foreach($tokens as $token) { echo "{$token[0]} ({$token[1]})"; }
Output for 7.0.0 - 7.1.0
array(17) { [0]=> array(3) { [0]=> int(379) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> array(3) { [0]=> int(320) [1]=> string(2) "$a" [2]=> int(1) } [2]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(1) } [3]=> string(1) "=" [4]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(1) } [5]=> array(3) { [0]=> int(317) [1]=> string(1) "1" [2]=> int(1) } [6]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(1) } [7]=> string(1) "+" [8]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(1) } [9]=> array(3) { [0]=> int(317) [1]=> string(1) "2" [2]=> int(1) } [10]=> string(1) ";" [11]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(1) } [12]=> array(3) { [0]=> int(328) [1]=> string(4) "echo" [2]=> int(1) } [13]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(1) } [14]=> array(3) { [0]=> int(320) [1]=> string(2) "$a" [2]=> int(1) } [15]=> array(3) { [0]=> int(382) [1]=> string(1) " " [2]=> int(1) } [16]=> array(3) { [0]=> int(381) [1]=> string(2) "?>" [2]=> int(1) } } 379 (<?php )320 ($a)382 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 = ()382 ( )317 (1)382 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 + ()382 ( )317 (2) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 ; ()382 ( )328 (echo)382 ( )320 ($a)382 ( )381 (?>)
Output for 5.6.7 - 5.6.28
array(17) { [0]=> array(3) { [0]=> int(376) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> array(3) { [0]=> int(312) [1]=> string(2) "$a" [2]=> int(1) } [2]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(1) } [3]=> string(1) "=" [4]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(1) } [5]=> array(3) { [0]=> int(308) [1]=> string(1) "1" [2]=> int(1) } [6]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(1) } [7]=> string(1) "+" [8]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(1) } [9]=> array(3) { [0]=> int(308) [1]=> string(1) "2" [2]=> int(1) } [10]=> string(1) ";" [11]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(1) } [12]=> array(3) { [0]=> int(319) [1]=> string(4) "echo" [2]=> int(1) } [13]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(1) } [14]=> array(3) { [0]=> int(312) [1]=> string(2) "$a" [2]=> int(1) } [15]=> array(3) { [0]=> int(379) [1]=> string(1) " " [2]=> int(1) } [16]=> array(3) { [0]=> int(378) [1]=> string(2) "?>" [2]=> int(1) } } 376 (<?php )312 ($a)379 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 = ()379 ( )308 (1)379 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 + ()379 ( )308 (2) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 ; ()379 ( )319 (echo)379 ( )312 ($a)379 ( )378 (?>)
Output for 5.5.24 - 5.5.35
array(17) { [0]=> array(3) { [0]=> int(374) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> array(3) { [0]=> int(310) [1]=> string(2) "$a" [2]=> int(1) } [2]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(1) } [3]=> string(1) "=" [4]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(1) } [5]=> array(3) { [0]=> int(306) [1]=> string(1) "1" [2]=> int(1) } [6]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(1) } [7]=> string(1) "+" [8]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(1) } [9]=> array(3) { [0]=> int(306) [1]=> string(1) "2" [2]=> int(1) } [10]=> string(1) ";" [11]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(1) } [12]=> array(3) { [0]=> int(317) [1]=> string(4) "echo" [2]=> int(1) } [13]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(1) } [14]=> array(3) { [0]=> int(310) [1]=> string(2) "$a" [2]=> int(1) } [15]=> array(3) { [0]=> int(377) [1]=> string(1) " " [2]=> int(1) } [16]=> array(3) { [0]=> int(376) [1]=> string(2) "?>" [2]=> int(1) } } 374 (<?php )310 ($a)377 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 = ()377 ( )306 (1)377 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 + ()377 ( )306 (2) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 ; ()377 ( )317 (echo)377 ( )310 ($a)377 ( )376 (?>)
Output for 5.4.0 - 5.4.45
array(17) { [0]=> array(3) { [0]=> int(372) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> array(3) { [0]=> int(309) [1]=> string(2) "$a" [2]=> int(1) } [2]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(1) } [3]=> string(1) "=" [4]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(1) } [5]=> array(3) { [0]=> int(305) [1]=> string(1) "1" [2]=> int(1) } [6]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(1) } [7]=> string(1) "+" [8]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(1) } [9]=> array(3) { [0]=> int(305) [1]=> string(1) "2" [2]=> int(1) } [10]=> string(1) ";" [11]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(1) } [12]=> array(3) { [0]=> int(316) [1]=> string(4) "echo" [2]=> int(1) } [13]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(1) } [14]=> array(3) { [0]=> int(309) [1]=> string(2) "$a" [2]=> int(1) } [15]=> array(3) { [0]=> int(375) [1]=> string(1) " " [2]=> int(1) } [16]=> array(3) { [0]=> int(374) [1]=> string(2) "?>" [2]=> int(1) } } 372 (<?php )309 ($a)375 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 = ()375 ( )305 (1)375 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 + ()375 ( )305 (2) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 ; ()375 ( )316 (echo)375 ( )309 ($a)375 ( )374 (?>)
Output for 5.3.0 - 5.3.29
array(17) { [0]=> array(3) { [0]=> int(368) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> array(3) { [0]=> int(309) [1]=> string(2) "$a" [2]=> int(1) } [2]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(1) } [3]=> string(1) "=" [4]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(1) } [5]=> array(3) { [0]=> int(305) [1]=> string(1) "1" [2]=> int(1) } [6]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(1) } [7]=> string(1) "+" [8]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(1) } [9]=> array(3) { [0]=> int(305) [1]=> string(1) "2" [2]=> int(1) } [10]=> string(1) ";" [11]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(1) } [12]=> array(3) { [0]=> int(316) [1]=> string(4) "echo" [2]=> int(1) } [13]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(1) } [14]=> array(3) { [0]=> int(309) [1]=> string(2) "$a" [2]=> int(1) } [15]=> array(3) { [0]=> int(371) [1]=> string(1) " " [2]=> int(1) } [16]=> array(3) { [0]=> int(370) [1]=> string(2) "?>" [2]=> int(1) } } 368 (<?php )309 ($a)371 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 = ()371 ( )305 (1)371 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 + ()371 ( )305 (2) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 ; ()371 ( )316 (echo)371 ( )309 ($a)371 ( )370 (?>)
Output for 5.2.10 - 5.2.17
array(17) { [0]=> array(3) { [0]=> int(367) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> array(3) { [0]=> int(309) [1]=> string(2) "$a" [2]=> int(1) } [2]=> array(3) { [0]=> int(370) [1]=> string(1) " " [2]=> int(1) } [3]=> string(1) "=" [4]=> array(3) { [0]=> int(370) [1]=> string(1) " " [2]=> int(1) } [5]=> array(3) { [0]=> int(305) [1]=> string(1) "1" [2]=> int(1) } [6]=> array(3) { [0]=> int(370) [1]=> string(1) " " [2]=> int(1) } [7]=> string(1) "+" [8]=> array(3) { [0]=> int(370) [1]=> string(1) " " [2]=> int(1) } [9]=> array(3) { [0]=> int(305) [1]=> string(1) "2" [2]=> int(1) } [10]=> string(1) ";" [11]=> array(3) { [0]=> int(370) [1]=> string(1) " " [2]=> int(1) } [12]=> array(3) { [0]=> int(316) [1]=> string(4) "echo" [2]=> int(1) } [13]=> array(3) { [0]=> int(370) [1]=> string(1) " " [2]=> int(1) } [14]=> array(3) { [0]=> int(309) [1]=> string(2) "$a" [2]=> int(1) } [15]=> array(3) { [0]=> int(370) [1]=> string(1) " " [2]=> int(1) } [16]=> array(3) { [0]=> int(369) [1]=> string(2) "?>" [2]=> int(1) } } 367 (<?php )309 ($a)370 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 = ()370 ( )305 (1)370 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 + ()370 ( )305 (2) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 ; ()370 ( )316 (echo)370 ( )309 ($a)370 ( )369 (?>)
Output for 5.2.2 - 5.2.9
array(17) { [0]=> array(3) { [0]=> int(367) [1]=> string(6) "<?php " [2]=> int(1) } [1]=> array(3) { [0]=> int(309) [1]=> string(2) "$a" [2]=> int(1) } [2]=> array(3) { [0]=> int(370) [1]=> string(1) " " [2]=> int(1) } [3]=> string(1) "=" [4]=> array(3) { [0]=> int(370) [1]=> string(1) " " [2]=> int(1) } [5]=> array(3) { [0]=> int(305) [1]=> string(1) "1" [2]=> int(1) } [6]=> array(3) { [0]=> int(370) [1]=> string(1) " " [2]=> int(1) } [7]=> string(1) "+" [8]=> array(3) { [0]=> int(370) [1]=> string(1) " " [2]=> int(1) } [9]=> array(3) { [0]=> int(305) [1]=> string(1) "2" [2]=> int(1) } [10]=> string(1) ";" [11]=> array(3) { [0]=> int(370) [1]=> string(1) " " [2]=> int(1) } [12]=> array(3) { [0]=> int(316) [1]=> string(4) "echo" [2]=> int(1) } [13]=> array(3) { [0]=> int(370) [1]=> string(1) " " [2]=> int(1) } [14]=> array(3) { [0]=> int(309) [1]=> string(2) "$a" [2]=> int(1) } [15]=> array(3) { [0]=> int(370) [1]=> string(1) " " [2]=> int(1) } [16]=> array(3) { [0]=> int(369) [1]=> string(2) "?>" [2]=> int(1) } } 367 (<?php )309 ($a)370 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 = ()370 ( )305 (1)370 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 + ()370 ( )305 (2) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 ; ()370 ( )316 (echo)370 ( )309 ($a)370 ( )369 (?>)
Output for 5.1.0 - 5.2.1
array(17) { [0]=> array(2) { [0]=> int(367) [1]=> string(6) "<?php " } [1]=> array(2) { [0]=> int(309) [1]=> string(2) "$a" } [2]=> array(2) { [0]=> int(370) [1]=> string(1) " " } [3]=> string(1) "=" [4]=> array(2) { [0]=> int(370) [1]=> string(1) " " } [5]=> array(2) { [0]=> int(305) [1]=> string(1) "1" } [6]=> array(2) { [0]=> int(370) [1]=> string(1) " " } [7]=> string(1) "+" [8]=> array(2) { [0]=> int(370) [1]=> string(1) " " } [9]=> array(2) { [0]=> int(305) [1]=> string(1) "2" } [10]=> string(1) ";" [11]=> array(2) { [0]=> int(370) [1]=> string(1) " " } [12]=> array(2) { [0]=> int(316) [1]=> string(4) "echo" } [13]=> array(2) { [0]=> int(370) [1]=> string(1) " " } [14]=> array(2) { [0]=> int(309) [1]=> string(2) "$a" } [15]=> array(2) { [0]=> int(370) [1]=> string(1) " " } [16]=> array(2) { [0]=> int(369) [1]=> string(2) "?>" } } 367 (<?php )309 ($a)370 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 = ()370 ( )305 (1)370 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 + ()370 ( )305 (2) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 ; ()370 ( )316 (echo)370 ( )309 ($a)370 ( )369 (?>)
Output for 5.0.0 - 5.0.5
array(17) { [0]=> array(2) { [0]=> int(365) [1]=> string(6) "<?php " } [1]=> array(2) { [0]=> int(308) [1]=> string(2) "$a" } [2]=> array(2) { [0]=> int(368) [1]=> string(1) " " } [3]=> string(1) "=" [4]=> array(2) { [0]=> int(368) [1]=> string(1) " " } [5]=> array(2) { [0]=> int(304) [1]=> string(1) "1" } [6]=> array(2) { [0]=> int(368) [1]=> string(1) " " } [7]=> string(1) "+" [8]=> array(2) { [0]=> int(368) [1]=> string(1) " " } [9]=> array(2) { [0]=> int(304) [1]=> string(1) "2" } [10]=> string(1) ";" [11]=> array(2) { [0]=> int(368) [1]=> string(1) " " } [12]=> array(2) { [0]=> int(315) [1]=> string(4) "echo" } [13]=> array(2) { [0]=> int(368) [1]=> string(1) " " } [14]=> array(2) { [0]=> int(308) [1]=> string(2) "$a" } [15]=> array(2) { [0]=> int(368) [1]=> string(1) " " } [16]=> array(2) { [0]=> int(367) [1]=> string(2) "?>" } } 365 (<?php )308 ($a)368 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 = ()368 ( )304 (1)368 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 + ()368 ( )304 (2) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 ; ()368 ( )315 (echo)368 ( )308 ($a)368 ( )367 (?>)
Output for 4.4.2 - 4.4.9
array(17) { [0]=> array(2) { [0]=> int(354) [1]=> string(6) "<?php " } [1]=> array(2) { [0]=> int(307) [1]=> string(2) "$a" } [2]=> array(2) { [0]=> int(357) [1]=> string(1) " " } [3]=> string(1) "=" [4]=> array(2) { [0]=> int(357) [1]=> string(1) " " } [5]=> array(2) { [0]=> int(303) [1]=> string(1) "1" } [6]=> array(2) { [0]=> int(357) [1]=> string(1) " " } [7]=> string(1) "+" [8]=> array(2) { [0]=> int(357) [1]=> string(1) " " } [9]=> array(2) { [0]=> int(303) [1]=> string(1) "2" } [10]=> string(1) ";" [11]=> array(2) { [0]=> int(357) [1]=> string(1) " " } [12]=> array(2) { [0]=> int(314) [1]=> string(4) "echo" } [13]=> array(2) { [0]=> int(357) [1]=> string(1) " " } [14]=> array(2) { [0]=> int(307) [1]=> string(2) "$a" } [15]=> array(2) { [0]=> int(357) [1]=> string(1) " " } [16]=> array(2) { [0]=> int(356) [1]=> string(2) "?>" } } 354 (<?php )307 ($a)357 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 = ()357 ( )303 (1)357 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 + ()357 ( )303 (2) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 ; ()357 ( )314 (echo)357 ( )307 ($a)357 ( )356 (?>)
Output for 4.3.0 - 4.4.1
array(17) { [0]=> array(2) { [0]=> int(353) [1]=> string(6) "<?php " } [1]=> array(2) { [0]=> int(306) [1]=> string(2) "$a" } [2]=> array(2) { [0]=> int(356) [1]=> string(1) " " } [3]=> string(1) "=" [4]=> array(2) { [0]=> int(356) [1]=> string(1) " " } [5]=> array(2) { [0]=> int(302) [1]=> string(1) "1" } [6]=> array(2) { [0]=> int(356) [1]=> string(1) " " } [7]=> string(1) "+" [8]=> array(2) { [0]=> int(356) [1]=> string(1) " " } [9]=> array(2) { [0]=> int(302) [1]=> string(1) "2" } [10]=> string(1) ";" [11]=> array(2) { [0]=> int(356) [1]=> string(1) " " } [12]=> array(2) { [0]=> int(313) [1]=> string(4) "echo" } [13]=> array(2) { [0]=> int(356) [1]=> string(1) " " } [14]=> array(2) { [0]=> int(306) [1]=> string(2) "$a" } [15]=> array(2) { [0]=> int(356) [1]=> string(1) " " } [16]=> array(2) { [0]=> int(355) [1]=> string(2) "?>" } } 353 (<?php )306 ($a)356 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 = ()356 ( )302 (1)356 ( ) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 + ()356 ( )302 (2) Notice: Uninitialized string offset: 1 in /in/ONZAS on line 6 ; ()356 ( )313 (echo)356 ( )306 ($a)356 ( )355 (?>)