<?php $pattern = '/[^\w]fox\s/'; if (preg_match($pattern, 'The quick brown fox jumps over the lazy dog')) { echo "'fox' is present..."; } else echo "'fox' is not present..."; ?> - See more at: http://www.w3resource.com/php-exercises/php-regular-expression-exercises.php#sthash.nM2kC95Q.dpuf
<?php $pattern = '/[^\w]fox\s/'; if (preg_match($pattern, 'The quick brown fox jumps over the lazy dog')) { echo "'fox' is present..."; } else echo "'fox' is not present..."; ?> - See more at: http://www.w3resource.com/php-exercises/php-regular-expression-exercises.php#sthash.nM2kC95Q.dpuf
Output for 8.0.13
Parse error: syntax error, unexpected variable "$pattern " in /in/BQmiL on line 1
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.33
Parse error: syntax error, unexpected '$pattern ' (T_VARIABLE) in /in/BQmiL on line 1
Process exited with code 255.