• PHP Video Tutorials

PHP - Function Substr_compare



Syntax

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

Definition and Usage

It used to compare two string format a specific start position

Return Values

It returns the string functions

Parameters

Sr.No Parameters & Description
1

string1

It is used to first string to compare

2

string2

It is used to second string to compare

3

startpos

It specifies where to start string comparing in string1

4

length

It specifies length of a string

5

case

The boolean value that specifies where to perform a case-sensitive compare

Example

Try out the following example

<?php
   echo substr_compare("SAi RAM","RAM",6);
?>

This will produce following result −

-5
php_function_reference.htm
Advertisements