Sunday, 27 July 2014

Filled Under:

strcmp() in php

strcmp() Function:

                             strcmp() function is use to compare the two string. The function return zero if two string are equal. If string1 greater than string2 then it return positive value or If string1 less than string2 then it return negative value.

Syntax:

          Strcmp(string1,string2);

Example:

<?php
echo strcmp(“php”,”php”);
echo strcmp(“php hello”,”php”);
echo strcmp(“php”,”php hello”);
?>

Output:                                        


          0 6 -6




0 comments:

Post a Comment