3v4l.org

run code in 300+ PHP versions simultaneously
<?php private static function _removeAllButCode( $source ) { $commentTokens = array( T_COMMENT => true, T_INLINE_HTML => true, T_DOC_COMMENT => true ); $whiteSpaceTokens = array( T_WHITESPACE => true, T_CLOSE_TAG => true, T_OPEN_TAG => true, T_OPEN_TAG_WITH_ECHO => true, ); $cleanedSource = ''; foreach ( token_get_all( $source ) as $token ) { if ( is_array( $token ) ) { if ( isset( $commentTokens[ $token[0] ] ) ) continue; if ( isset( $whiteSpaceTokens[ $token[0] ] ) ) { $token = "\x07"; } else { $token = $token[1]; } } elseif ( $token === ';' ) { $token = "\x07"; } $cleanedSource .= $token; } return $cleanedSource; }
Output for 5.4.0 - 5.4.34
Parse error: syntax error, unexpected 'private' (T_PRIVATE) in /in/7h4m7 on line 3
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_PRIVATE in /in/7h4m7 on line 3
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_PRIVATE in /in/7h4m7 on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STATIC in /in/7h4m7 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STATIC in /in/7h4m7 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/7h4m7 on line 3
Process exited with code 255.

preferences:
207.63 ms | 1395 KiB | 124 Q