I am looking for a function in PHP that can do a comparison of two strings with numbers. They should at least 5 same letters/number in consecutive order.
Example:
AD-2018-34567-234
and cd 34567
both contains same letters/number = 34567
OR
10256
and cd 10256
both contains 10256
OR
1234567890- rfwet043-123455-cd1234-sdf
and 4edgs-cd12340e-3ed
both contains cd1234
Tried using this function here but doesn't meet my needs.
$str1 = "AD-2018-34567-234";
$str2 = "cd 34567";
$str3 = "10256";
$str4 = "cd 10256";
$str5= "1234567890-rfwet043-123455-cd1234-sdf";
$str6= "4edgs-cd12340e-3ed";
if(strpos($str1, $str2) !== false) {
echo "matched";
}else{
echo "not matched";
}
if(strpos($str3, $str4) !== false) {
echo "matched";
}else{
echo "not matched";
}
if(strpos($str5, $str6) !== false) {
echo "matched";
}else{
echo "not matched";
}
Tried also strpos
all did not match.