I have two strings like followings:
$s1 = “abccddkkxyz”;
$s2 = “12334466987”;
How to recognize ccddkk in $s1 and 334466 in $s2 ?
Thank you for your helps.
I have two strings like followings:
$s1 = “abccddkkxyz”;
$s2 = “12334466987”;
How to recognize ccddkk in $s1 and 334466 in $s2 ?
Thank you for your helps.
As both your starting values are quoted they are treated as strings in this instance.
Take a look at how [fphp]strstr/fphp and [fphp]strpos[/fphp] work.
What is the source of your two strings? Are they from the results from a database query?
It may be a co-incidence but both search strings are six characters long and both occur in the source string starting at the second character ( 0 is the first character).
If on the off-chance the string you are searching always occurs in the same place then you could use the following:
echo substr( $s1, 2, 6); # ccddkk
echo substr( $s2, 2, 6); # 334466