3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = 'WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHIT E SPACE WHITE SPA CE WHIT   CE WHITE SPA CE WHI SP HIT  E SPACE WHITE SPACE WHITE SPACE WHITE SPACE   WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE  W HIT E SPACE WHITE S    PACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHI TE SPA CE W HITE SP ACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHI TE SPACE WHI TE SPACE WHI TE SPACE WHITE SPACE WHIT E SPACE WHI TE SPACE W HITE SP ACE WH ITE SPA     CE  WHI CE WHITE SP ACE WHITE SPACE WHITE SPACE WHITE SPA CE WHITE SPACE WHITE SPACE W HITE SPACE WHITE SPACE WHITE SPACE W HITE SPACE WHITE SPACE WHITE SPACE WHI TE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE W HITE SPACE WHITE SPACE WHITE SPACE WH PACE WHITE SPACE WHITE SPACE WH ITE SPACE WHITE SPA CE WHITE SPACE WHITE SPACE WHIT E SPACE WHIT E S PA CE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WH ITE SPACE WHITE SPACE WHITE SPACE W H I TE SPA CE WHITE SPACE WHITE SPAC E WHIT E SPACE H IT E SPACE WHITE SPACE WHIT E SPACE WHITE S PACE WHITE S PACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WH ITE SPACE WHITE SPACE WHITE SPA CE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE S PACE WHITE SPACE WHITE SPACE WHITE SPACE WHIT E SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SP ACE WHI TE S PACE WH ITE SP ACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPAC E WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE HITE SPAC E WHITE SPACE WHITE SP ACE W HI T E SP ACE WHIT E S PACE WHITE SPACE WHITE SPACE '; $trim = function($string) { // trim only strings if(!is_string($string)) { return $string; } // strip whitespaces chars from the begining $string = preg_replace('/^\s*/', '', $string); // strip whitespaces chars from the ending $string = preg_replace('/\s*$/', '', $string); // die(dump($string)); return $string; }; echo $trim($string); ?>
based on Ua20n
Output for 5.3.0 - 7.2.0
WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHIT E SPACE WHITE SPA CE WHIT   CE WHITE SPA CE WHI SP HIT  E SPACE WHITE SPACE WHITE SPACE WHITE SPACE   WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE  W HIT E SPACE WHITE S    PACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHI TE SPA CE W HITE SP ACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHI TE SPACE WHI TE SPACE WHI TE SPACE WHITE SPACE WHIT E SPACE WHI TE SPACE W HITE SP ACE WH ITE SPA     CE  WHI CE WHITE SP ACE WHITE SPACE WHITE SPACE WHITE SPA CE WHITE SPACE WHITE SPACE W HITE SPACE WHITE SPACE WHITE SPACE W HITE SPACE WHITE SPACE WHITE SPACE WHI TE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE W HITE SPACE WHITE SPACE WHITE SPACE WH PACE WHITE SPACE WHITE SPACE WH ITE SPACE WHITE SPA CE WHITE SPACE WHITE SPACE WHIT E SPACE WHIT E S PA CE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WH ITE SPACE WHITE SPACE WHITE SPACE W H I TE SPA CE WHITE SPACE WHITE SPAC E WHIT E SPACE H IT E SPACE WHITE SPACE WHIT E SPACE WHITE S PACE WHITE S PACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WH ITE SPACE WHITE SPACE WHITE SPA CE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE S PACE WHITE SPACE WHITE SPACE WHITE SPACE WHIT E SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SP ACE WHI TE S PACE WH ITE SP ACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPAC E WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE SPACE WHITE HITE SPAC E WHITE SPACE WHITE SP ACE W HI T E SP ACE WHIT E S PACE WHITE SPACE WHITE SPACE
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/eBIlK on line 298
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/eBIlK on line 298
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/eBIlK on line 298
Process exited with code 255.