PHP

PHP Menu

PHP

strcmp() Function - Definition, Syntax, Parameters, Examples

Definition

The strcmp() function compares two strings. This function is binary-safe and case-sensitive.

Syntax

strcmp(string1, string2)

Parameters

Parameter Description
string1 Required. Specifies the first string to compare.
string2 Required. Specifies the second string to compare.

Example

<?php
echo strcmp("Welcome to PHP!", "welcome to php!");

Introduction

PHP Basics

PHP Advance

PHP OOP

PHP Functions and Methods