> > >I am trying to find out which string is the longest and then > find out > >what is different between the two string. Sometimes String 2 > is longer > >than String 1 The script below works sometimes but not all the time. > >Is there a better way to do this or tell me what is wrong with the > >script I am using > > > >$string1 = "1,2,3,4,5,6,7,8"; > >$string2 = "1,2,3,4,6,7,8"; > > > > > Can you give us an example of two strings where the comparison fails? > I suspect you are looking for the number of "entries" in the > string, rather than the length of the string. For example: > $string1 = "1,2,3,4,5,6,9"; > $string2 = "1,2,3,10,11,12"; > > number of entries in $string1 is 7, number of entries in > $string2 is 6, but length($string1) = 13, while > length($string2) = 14. Is this the problem you are seeing? > Yes that is the problem $string2 is what is saved in the database and string1 is coming from a form. The form has every thing that is in the database but could have some items added and some removed. I need to know what is different so I can add to or remove from a separate table so both tables are the same. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php