3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $mlbCities = array( 'Carolina', 'Atlanta', 'New Orleans', 'Philadelphia', 'St. Louis', 'Washington', 'Houston', 'Tennessee', 'New England', 'NY Jets', 'Cincinnati', 'Green Bay', 'Arizona', 'Jacksonville', 'Oakland', 'Kansas City', 'Minnesota', 'Detroit', 'Tampa Bay', 'Buffalo', 'Seattle', 'San Francisco', 'Pittsburgh', 'Chicago', 'Baltimore', 'San Diego', 'Cleveland', 'Denver', 'NY Giants', 'Dallas', 'Indianapolis', 'Miami' ); $string = 'San Francisco Giants'; foreach($mlbCities as $city) { var_dump($city); var_dump($string); $fl_array = preg_match("/$city/", $string); var_dump($fl_array); } ?>
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
string(8) "Carolina" string(20) "San Francisco Giants" int(0) string(7) "Atlanta" string(20) "San Francisco Giants" int(0) string(11) "New Orleans" string(20) "San Francisco Giants" int(0) string(12) "Philadelphia" string(20) "San Francisco Giants" int(0) string(9) "St. Louis" string(20) "San Francisco Giants" int(0) string(10) "Washington" string(20) "San Francisco Giants" int(0) string(7) "Houston" string(20) "San Francisco Giants" int(0) string(9) "Tennessee" string(20) "San Francisco Giants" int(0) string(11) "New England" string(20) "San Francisco Giants" int(0) string(7) "NY Jets" string(20) "San Francisco Giants" int(0) string(10) "Cincinnati" string(20) "San Francisco Giants" int(0) string(9) "Green Bay" string(20) "San Francisco Giants" int(0) string(7) "Arizona" string(20) "San Francisco Giants" int(0) string(12) "Jacksonville" string(20) "San Francisco Giants" int(0) string(7) "Oakland" string(20) "San Francisco Giants" int(0) string(11) "Kansas City" string(20) "San Francisco Giants" int(0) string(9) "Minnesota" string(20) "San Francisco Giants" int(0) string(7) "Detroit" string(20) "San Francisco Giants" int(0) string(9) "Tampa Bay" string(20) "San Francisco Giants" int(0) string(7) "Buffalo" string(20) "San Francisco Giants" int(0) string(7) "Seattle" string(20) "San Francisco Giants" int(0) string(13) "San Francisco" string(20) "San Francisco Giants" int(1) string(10) "Pittsburgh" string(20) "San Francisco Giants" int(0) string(7) "Chicago" string(20) "San Francisco Giants" int(0) string(9) "Baltimore" string(20) "San Francisco Giants" int(0) string(9) "San Diego" string(20) "San Francisco Giants" int(0) string(9) "Cleveland" string(20) "San Francisco Giants" int(0) string(6) "Denver" string(20) "San Francisco Giants" int(0) string(9) "NY Giants" string(20) "San Francisco Giants" int(0) string(6) "Dallas" string(20) "San Francisco Giants" int(0) string(12) "Indianapolis" string(20) "San Francisco Giants" int(0) string(5) "Miami" string(20) "San Francisco Giants" int(0)
Output for hhvm-3.10.0

Process exited with code 153.