![]() |
Unexpected Results
PHP Code:
When b = "n": n.two=2,n.one=1 When b = "one": n.one=1 When b = "t": ... Nothing. When b = "o": ... Nothing. When b = "n.": ... Nothing. When b = "=": ... Nothing. When b = "1": n.one=1 Summary: When using the 'contains' function, the results vary. By deduction, we can see that if a string contains "two", than it must contain "t", however... It returns false. It seems like the string is split by symbols ( ., =, " ", etc etc ) and then they are compared token[x] == needle. Working Version: PHP Code:
|
Thinking about it... contains is probably for arrays... If that's the case, I guess the results would be a little more expected...
But -- If that's the case: would there be a 'contains' for strings? |
Yes contains() is for arrays I believe.
I think you can use haystack.pos(needle) >= -1 to check for an occurence in a string. |
Contains() is checking for substrings which are enclosed with one of those characters:
".,;:-_><|!\"$%&/\\()=?`{[]}+*~#''^ " Example: contains("hello you","you") = true The text "two" is not containing a word "t" |
| All times are GMT +2. The time now is 03:41 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.