Link to home
Start Free TrialLog in
Avatar of infodigger
infodigger

asked on

smiliar_text() function in PHP

I have a question regarding similar_text() function in php.

Is there a way so that if there are two strings with the same words but in different order to return 100%?

For example:
similar_text("George Michael", "Michael George", $percent1); //Returns 50
similar_text("George Michael", "George Michael", $percent2); //Returns 100

Open in new window


Thanks a lot!
John
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Sure. Make an array from the words and sort the array.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of infodigger
infodigger

ASKER

Thanks Ray!

As always a very complete and useful answer:)

Kind regards,
John
Thanks, John.  Glad to help!