3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "<?php\n class test{\n }\n \n someclasss::method('Class not found');\n "; var_dump( json_encode(token_get_all( $str ) ));
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.1, 8.3.3, 8.3.5 - 8.3.6
string(223) "[[389,"<?php\n",1],[392,"\n",2],[333,"class",3],[392," ",3],[262,"test",3],"{",[392,"\n\n",3],"}",[392,"\n\n\n\n",5],[262,"someclasss",9],[397,"::",9],[262,"method",9],"(",[269,"'Class not found'",9],")",";",[392,"\n\n",9]]"
Output for 8.3.0, 8.3.2, 8.3.4
string(223) "[[394,"<?php\n",1],[397,"\n",2],[369,"class",3],[397," ",3],[313,"test",3],"{",[397,"\n\n",3],"}",[397,"\n\n\n\n",5],[313,"someclasss",9],[402,"::",9],[313,"method",9],"(",[320,"'Class not found'",9],")",";",[397,"\n\n",9]]"
Output for 8.0.30
string(223) "[[387,"<?php\n",1],[390,"\n",2],[332,"class",3],[390," ",3],[262,"test",3],"{",[390,"\n\n",3],"}",[390,"\n\n\n\n",5],[262,"someclasss",9],[395,"::",9],[262,"method",9],"(",[269,"'Class not found'",9],")",";",[390,"\n\n",9]]"
Output for 8.0.0 - 8.0.29
string(223) "[[390,"<?php\n",1],[393,"\n",2],[366,"class",3],[393," ",3],[311,"test",3],"{",[393,"\n\n",3],"}",[393,"\n\n\n\n",5],[311,"someclasss",9],[398,"::",9],[311,"method",9],"(",[318,"'Class not found'",9],")",";",[393,"\n\n",9]]"
Output for 7.4.0 - 7.4.33
string(223) "[[382,"<?php\n",1],[385,"\n",2],[364,"class",3],[385," ",3],[311,"test",3],"{",[385,"\n\n",3],"}",[385,"\n\n\n\n",5],[311,"someclasss",9],[390,"::",9],[311,"method",9],"(",[315,"'Class not found'",9],")",";",[385,"\n\n",9]]"
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33
string(223) "[[379,"<?php\n",1],[382,"\n",2],[361,"class",3],[382," ",3],[319,"test",3],"{",[382,"\n\n",3],"}",[382,"\n\n\n\n",5],[319,"someclasss",9],[387,"::",9],[319,"method",9],"(",[323,"'Class not found'",9],")",";",[382,"\n\n",9]]"
Output for 5.6.0 - 5.6.28
string(223) "[[376,"<?php\n",1],[379,"\n",2],[358,"class",3],[379," ",3],[310,"test",3],"{",[379,"\n\n",3],"}",[379,"\n\n\n\n",5],[310,"someclasss",9],[384,"::",9],[310,"method",9],"(",[318,"'Class not found'",9],")",";",[379,"\n\n",9]]"
Output for 5.5.0 - 5.5.38
string(223) "[[374,"<?php\n",1],[377,"\n",2],[356,"class",3],[377," ",3],[308,"test",3],"{",[377,"\n\n",3],"}",[377,"\n\n\n\n",5],[308,"someclasss",9],[382,"::",9],[308,"method",9],"(",[316,"'Class not found'",9],")",";",[377,"\n\n",9]]"
Output for 5.4.0 - 5.4.45
string(223) "[[372,"<?php\n",1],[375,"\n",2],[354,"class",3],[375," ",3],[307,"test",3],"{",[375,"\n\n",3],"}",[375,"\n\n\n\n",5],[307,"someclasss",9],[380,"::",9],[307,"method",9],"(",[315,"'Class not found'",9],")",";",[375,"\n\n",9]]"
Output for 5.3.0 - 5.3.29
string(223) "[[368,"<?php\n",1],[371,"\n",2],[353,"class",3],[371," ",3],[307,"test",3],"{",[371,"\n\n",3],"}",[371,"\n\n\n\n",5],[307,"someclasss",9],[376,"::",9],[307,"method",9],"(",[315,"'Class not found'",9],")",";",[371,"\n\n",9]]"
Output for 5.2.2 - 5.2.17
string(223) "[[367,"<?php\n",1],[370,"\n",2],[352,"class",3],[370," ",3],[307,"test",3],"{",[370,"\n\n",3],"}",[370,"\n\n\n\n",5],[307,"someclasss",9],[375,"::",9],[307,"method",9],"(",[315,"'Class not found'",9],")",";",[370,"\n\n",9]]"
Output for 5.2.0 - 5.2.1
string(199) "[[367,"<?php\n"],[370,"\n"],[352,"class"],[370," "],[307,"test"],"{",[370,"\n\n"],"}",[370,"\n\n\n\n"],[307,"someclasss"],[375,"::"],[307,"method"],"(",[315,"'Class not found'"],")",";",[370,"\n\n"]]"
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Call to undefined function json_encode() in /in/j6q6k on line 10
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_encode() in /in/j6q6k on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: json_encode() in /in/j6q6k on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_encode() in /in/j6q6k on line 10

preferences:
229.82 ms | 401 KiB | 355 Q