3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $lines ="From: {Name|1} {Email|11} Phone / Skype: {Phone / Skype|8} removeIfEmpty Message Body: {Tell us more|9} removeIfEmpty Sender's IP: {ip} {refUTM} -- This e-mail was sent from a contact form on Software Development Company - Redwerk (http://redwerk.com)"; $pattern = "/^.*\bremoveIfEmpty\b.*$/m"; $matches = array(); preg_match_all($pattern, $lines, $matches); foreach($matches as $match) { preg_replace("/removeIfEmpty/", $match, ""); var_dump(trim($match)); }
based on sjTeJ
Output for 5.3.0 - 7.2.0
Warning: preg_replace(): Parameter mismatch, pattern is a string while replacement is an array in /in/rot5i on line 20 Warning: trim() expects parameter 1 to be string, array given in /in/rot5i on line 21 NULL
Output for 5.2.0 - 5.2.17
Warning: preg_replace(): Parameter mismatch, pattern is a string while replacement is an array in /in/rot5i on line 20 Notice: Array to string conversion in /in/rot5i on line 21 string(5) "Array"
Output for 4.3.2 - 5.1.6
Warning: preg_replace(): Parameter mismatch, pattern is a string while replacement in an array. in /in/rot5i on line 20 Notice: Array to string conversion in /in/rot5i on line 21 string(5) "Array"
Output for 4.3.0 - 4.3.1
Notice: Array to string conversion in /in/rot5i on line 21 string(5) "Array"