+ 1

Can someone kindly help me understand more about Strcmp() function in PHP?

1st Jul 2022, 11:20 PM
Juma Muyaka
Juma Muyaka - avatar
3 Answers
+ 5
Juma Muyaka The strcmp() function compares two strings. strcmp(string1,string2) Return Value: This function returns: 0 - if the two strings are equal value<0 - if string1 is less than string2 value>0 - if string1 is greater than string2 echo strcmp("Hello","Hello"); output= 0 equal echo strcmp("Hello","hELLo"); output=-32 as ASCII Code for H =71 and ASCII code for h = 104 result = 71-104=-32
1st Jul 2022, 11:30 PM
Aly Alsayed
Aly Alsayed - avatar
+ 2
Thank you Aly Alsayed
3rd Jul 2022, 9:24 AM
Juma Muyaka
Juma Muyaka - avatar
2nd Jul 2022, 3:40 PM
Oleh Davydenko
Oleh Davydenko - avatar