3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $opts = array ( 'English', //'French', 'Spanish', //'Hindi', //'Korean', ); $langs = array ( 'English', 'French', 'Spanish', 'Hindi', 'Korean', ); $recs = array ( array ('name' => 'Bart Simpson', 'lang' => 'English, Spanish'), array ('name' => 'Homer Simpson', 'lang' => 'English'), array ('name' => 'Marge Simpson', 'lang' => 'Hindi, Korean'), array ('name' => 'Lisa Simpson', 'lang' => 'English, French, Spanish, Hindi, Korean'), ); print 'looking for : ' . implode (', ', $opts) . "\n\n"; foreach ($recs as $r) { if (lang_match ($r, $opts)) print 'YES: ' . $r['name'] . ' - ' . $r['lang'] . "\n"; else print 'no: ' . $r['name'] . ' - ' . $r['lang'] . "\n"; } function lang_match ($r, $opts) { $rlang = preg_split ('/\s*,\s*/', $r['lang']); foreach ($opts as $o) if (! in_array ($o, $rlang)) return false; return true; }
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
looking for : English, Spanish YES: Bart Simpson - English, Spanish no: Homer Simpson - English no: Marge Simpson - Hindi, Korean YES: Lisa Simpson - English, French, Spanish, Hindi, Korean
Output for hhvm-3.10.0

Process exited with code 153.