+ 1
Can someone kindly help me understand more about Strcmp() function in PHP?
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
+ 2
Thank you Aly Alsayed