3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function testWordCount ($in) { $is_match = preg_match('/^(\b[^\s]+\s*){2,10}$/', $in); return (boolean)$is_match; } echo "3 words returns:\r\n" var_dump(testWordCount('This is three')) echo "\r\n"; echo "40 words returns:\r\n" var_dump(testWordCount('1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40')) echo "\r\n"; echo "40 words returns:\r\n" var_dump(testWordCount('1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41')) echo "\r\n";
Output for 5.4.0 - 5.4.27
Parse error: syntax error, unexpected 'var_dump' (T_STRING), expecting ',' or ';' in /in/nqeki on line 8
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /in/nqeki on line 8
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_STRING, expecting ',' or ';' in /in/nqeki on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `','' or `';'' in /in/nqeki on line 8
Process exited with code 255.