comparison in php using == and === operators -
in application, there values generated @ run time x, 1x,2,1 etc. need compare these:
as know,
x == 1 false '1x'== 1 true '1' == 1 true
for application, first,second cases needs false , 3rd needs true. if utilize ===,
x === 1 false '1x'=== 1 false 1' === 1 false
so both these comparisons can not use.
i think converting string , comparing using strcmp
best alternative have. please share thoughts. reply appreciated.
strcmp
suitable this.but should aware of homecoming values.
returns < 0 if str1 less str2; > 0 if str1 greater str2, , 0 if equal.
or can utilize regex
php
No comments:
Post a Comment