3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str1 = ["AD-2018-34567-234","10256","1234567890-rfwet043-123455-cd1234-sdf"]; $str2 = ["cd 34567","cd 10256","4edgs-cd12340e-3ed"]; foreach($str1 as $key => $str){ $find = $str2[$key]; $l = strlen($find); $match = false; for($i=0; $i<=($l-5);$i++){ // loop the find string //echo $str . " " . substr($find,$i, 5) . "\n"; // debug if(strpos($str, substr($find,$i, 5)) !== false) { // take five characters at the time and stros them $match = true; break; } } if($match){ echo "match\n"; }else{ echo "no match\n"; } }
Output for git.master_jit, git.master, rfc.property-hooks
match match match

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:
140.63 ms | 405 KiB | 5 Q