3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php if ($term=="mpv" || $term=="bmw" || $term=="mg") { echo strtoupper($term); } elseif(1 === preg_match('~[0-9]~', $term)){ echo "£$term"; } else { echo ucfirst($term); } ?> <!-- if(1 === preg_match('~[0-9]~', $string)){ echo "£$string"; } ?>
Output for 5.0.4 - 5.6.30, hhvm-3.10.1, 7.0.0 - 7.2.0
Notice: Undefined variable: term in /in/At6FK on line 3 Notice: Undefined variable: term in /in/At6FK on line 3 Notice: Undefined variable: term in /in/At6FK on line 3 Notice: Undefined variable: term in /in/At6FK on line 7 Notice: Undefined variable: term in /in/At6FK on line 12 <!-- if(1 === preg_match('~[0-9]~', $string)){ echo "£$string"; } ?>
Output for hhvm-3.11.1 - 3.17.3
Notice: Undefined variable: term in /in/At6FK on line 3 Notice: Undefined variable: term in /in/At6FK on line 3 Notice: Undefined variable: term in /in/At6FK on line 3 Notice: Undefined variable: term in /in/At6FK on line 7 Warning: preg_match() expects parameter 2 to be string, null given in /in/At6FK on line 7 Notice: Undefined variable: term in /in/At6FK on line 12 Warning: ucfirst() expects parameter 1 to be string, null given in /in/At6FK on line 12 <!-- if(1 === preg_match('~[0-9]~', $string)){ echo "£$string"; } ?>
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: term in /in/At6FK on line 3 Notice: Undefined variable: term in /in/At6FK on line 3 Notice: Undefined variable: term in /in/At6FK on line 3 Notice: Undefined variable: term in /in/At6FK on line 7 Notice: Undefined variable: term in /in/At6FK on line 12 <!-- if(1 === preg_match('~[0-9]~', $string)){ echo "£$string"; } ?>