Member Avatar

Hi guys, having a bit of trouble with the following piece of code, [CODE] <?php if (strcmp($pubinfo_username, $_SESSION['username'] ) == 0) { echo "<img alt=\"Remove this post\" height=\"20\" src=\"../images/btns/x.png\" width=\"25\">"; } ?> [/CODE] What I need this code to do is compare the string from the variable $pubinfo_username and compare it with the session stored username, It theoretically should work but doesn't, If there is a match then it returns 0 being TRUE and then show the remove button. But this code does not seem to work. Any ideas? Any help much appreciated! Jack

Member Avatar
+0 forum 2
Member Avatar

How can my program search for strings that has " " enclosing it and compare it to another string? Thanks for helping me!

Member Avatar
+0 forum 1
Member Avatar

I wrote this function to compare two strings and find their similarity. It returns the percent of their letters in common in place. ie "hello" and "yellow" share the "ello" (8 of 11 characters) and thus are 72.72 % similar. I feel like there is a better way to write this but I've yet to come up with it. [CODE=python] def RunComparison(str1, str2, param): comp = Compare(str1, str2, param) return comp.percent class Compare: def __init__(self, str1, str2, param): self.str1 = str1.lower() self.str2 = str2.lower() self.param = param self.most = 0 self.percent = self.LIC() def LIC(self): # Letters in common only …

Member Avatar
+0 forum 52

The End.