How to use substr compare in PHP

In this article I will explain how substr_count function can be used in PHP.
  • 1909

substr_compare() Function

This function compares two strings from a specified start position.

It returns:

  •   0 - if  two strings are equal
  • <0 - if string1 is less than string2
  • >0 - if string1 is greater than string2

Syntax

substr_compare(string1,string2,startpos,length,case)

Example

<html>
<body>
<?php
echo substr_compare("Hi Sachin","Hi Sachin",0);
?>
</body>
</html>

 

Output


substr-compare-php.jpg

You may also want to read these related articles Click here

Ask Your Question

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.