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.13
** 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.29, 8.3.0 - 8.3.25
** 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.33
** 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:
75.37 ms | 410 KiB | 5 Q