#70. PHP String Compare Functions
How to work PHP String Compare Functions?
Syntax & E.g
Run Code:
<?php
echo strcmp("Hello World","Hello World Hello");
// strncmp means length
echo strncmp("Hello World","hello World Hello", 5);
// strcasecmp
echo strcasecmp("HeLLo World","hello World World");
//strncasecmp
echo strncasecmp("HeLLo World","hello World World",5);
?>How to Work Sub String Compare Function?
<?php
//substr_compare
echo substr_compare("HeLLo world","World",0,3);
?>How to Work Similar Text Function?
Run code:
<?php
//similar_text means only matching the characters
echo similar_text("HeLLo world","hi World ", $per);
echo "Percentage :" . $per;
?>





Comments
Post a Comment