3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sentence = 'My New Scooter is very Good'; $array = [ "Good Scooter", "lovely very Good Scooter", "Scooter is very Good and New", "Scooter is very Good and its My New Scooter" ]; $words = explode(' ', $sentence); $winner = ['index' => false, 'count' => 0 ]; foreach ($array as $k => $v) { $common = array_intersect($words, explode(' ', $v)); if ( $winner['count'] < count($common) ) $winner = ['index' => $k, 'count' => count($common)]; if ( $winner['count'] === count($words) ) break; } var_dump($winner);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { ["index"]=> int(3) ["count"]=> int(6) }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
172.82 ms | 405 KiB | 5 Q