cuahangsimsodep — 2012-04-03T06:45:04-04:00 — #1
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.
cups — 2012-04-06T00:13:54-04:00 — #2
As both your starting values are quoted they are treated as strings in this instance.
Take a look at how strstr() and strpos work.
john_betong — 2012-04-06T00:40:46-04:00 — #3
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