Simple string comparison in php?

Charlie N

New member
Hi guys

I have simple string comparion question but im not sure how to attack it.

Given a string like : 'aaa bbb ccc ddd'
and another string like 'aaa bbb'
I want to know how many full elements are in both strings, in this case 2, the 'aaa' and 'bbb'

I thought maybe spilt the 2nd string into a array like [1] = aaa, [2] = bbb
and looping through to compare with the first string

Or somthing like that, the language is PHP
any help is appreciated
 
Back
Top