3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "\n** warning about bad pattern AND bad parameter: **\n"; var_dump(preg_match('bad pattern', null)); echo "\n** warning about bad pattern only: **\n"; var_dump(preg_match('bad pattern', '')); echo "\n** suppressed warnings: **\n"; var_dump(@preg_match('bad pattern', ''));
Output for 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
** warning about bad pattern AND bad parameter: ** Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /in/5YI6t on line 4 Warning: preg_match(): Delimiter must not be alphanumeric, backslash, or NUL byte in /in/5YI6t on line 4 bool(false) ** warning about bad pattern only: ** Warning: preg_match(): Delimiter must not be alphanumeric, backslash, or NUL byte in /in/5YI6t on line 7 bool(false) ** suppressed warnings: ** bool(false)
Output for 8.2.0 - 8.2.30, 8.3.0 - 8.3.30
** warning about bad pattern AND bad parameter: ** Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /in/5YI6t on line 4 Warning: preg_match(): Delimiter must not be alphanumeric, backslash, or NUL in /in/5YI6t on line 4 bool(false) ** warning about bad pattern only: ** Warning: preg_match(): Delimiter must not be alphanumeric, backslash, or NUL in /in/5YI6t on line 7 bool(false) ** suppressed warnings: ** bool(false)
Output for 8.1.0 - 8.1.34
** warning about bad pattern AND bad parameter: ** Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /in/5YI6t on line 4 Warning: preg_match(): Delimiter must not be alphanumeric or backslash in /in/5YI6t on line 4 bool(false) ** warning about bad pattern only: ** Warning: preg_match(): Delimiter must not be alphanumeric or backslash in /in/5YI6t on line 7 bool(false) ** suppressed warnings: ** bool(false)

preferences:
74.3 ms | 1029 KiB | 4 Q