• PHP Video Tutorials

PHP - Function Strncmp



Syntax

int strncmp ( string $str1 , string $str2 , int $len )

Definition and Usage

It is used compare first n character.

Return Values

It returns the string functions

Parameters

Sr.No Parameters & Description
1

string1

It specifies first string to search

2

string2

It specifies second string to search

3

length

It specifies number of characters from each string to be used in the comparison

Example

Try out the following example

<?php
   echo strncmp("input","input",6);
   echo "<br>";
   
   echo strncmp("input","iMPut",6);
?>

This will produce following result −

0
8448
php_function_reference.htm
Advertisements