<?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"; } }
You have javascript disabled. You will not be able to edit any code.