3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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; }
based on J8lcA
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.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.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.