SA-MP Forums Archive
strcmp - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: strcmp (/showthread.php?tid=636669)



strcmp - Bussyman - 02.07.2017

Hi,

If i strcmp empty string it return as it match or no? because in sa-mp if you strcmp empty string it always give that is match?


Re: strcmp - Freaksken - 02.07.2017

Check the important notes this wiki page.


Re: strcmp - Bussyman - 10.07.2017

I know but i talk about php strcmp if i compare empty string with non empty it return that it matches or no? is there same bug as in samp strcmp ?


Re: strcmp - Freaksken - 10.07.2017

Dude, just search for that php function on ****** and if you don't find what you want, it takes only a few seconds to test it yourself. You're going to learn a lot more when you find things yourself instead of other people telling you.


Re: strcmp - Kaperstone - 10.07.2017

If strcmp("", "") then yes.


Re: strcmp - Freaksken - 10.07.2017

Quote:
Originally Posted by Kaperstone
Посмотреть сообщение
If strcmp("", "") then yes.
That's not what he means. He means this note from the wiki:
Quote:

This function returns 0 if either string is empty. Check for null strings with isnull(). If you do not, for example, people can login to anyone's account by simply entering a blank password.




Re: strcmp - Kaperstone - 10.07.2017

Quote:
Originally Posted by Freaksken
Посмотреть сообщение
That's not what he means. He means this note from the wiki:
His other reply touched PHP.
Quote:
Originally Posted by Bussyman
Посмотреть сообщение
I know but i talk about php strcmp if i compare empty string with non empty it return that it matches or no? is there same bug as in samp strcmp ?
Whether PHP strcmp function has the same issue that SAMP's strcmp has (the one you mentioned)

In terms of PHP, strcmp will return 0 (match)
(tested it before I replied)


EDIT:
Must also note that
PHP код:
echo strcmp("","bug"); // -3 
PHP код:
echo strcmp("bug",""); // 3 



Re: strcmp - Freaksken - 10.07.2017

Quote:
Originally Posted by Kaperstone
Посмотреть сообщение
His other reply touched PHP.
Whether PHP strcmp function has the same issue that SAMP's strcmp has (the one you mentioned)
Yeah, I know, that's what I meant ...

Quote:
Originally Posted by Kaperstone
Посмотреть сообщение
PHP код:
echo strcmp("","bug"); // -3 
PHP код:
echo strcmp("bug",""); // 3 
I really don't agree with people being spoonfed the answer when it's so easy to find out themselves. They'll never learn this way.