PHP 中的 strcmp函数

首页 / PHP入门教程 / PHP 中的 strcmp函数

strcmp - 语法

strcmp(string1,string2)

它用于比较两个字符串

Sr.No 参数 & 描述
1

string1

无涯教程网

它指定要比较的第一个字符串

2

string2

链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-strcmp.html

来源:LearnFk无涯教程网

它指定要比较的第二个字符串

strcmp - 返回值

它返回字符串函数

strcmp - 示例

尝试以下示例

<?php
   echo "If this function returns 0, the two strings are equal.";
   echo "<br> The result is ";
   echo strcmp("Hello world!","Hello world!");
?>

这将产生以下输出-

If this function returns 0, the two strings are equal.
The result is 0

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

零基础学Python -〔尹会生〕

持续交付36讲 -〔王潇俊〕

网络编程实战 -〔盛延敏〕

说透敏捷 -〔宋宁〕

数据中台实战课 -〔郭忆〕

Tony Bai · Go语言第一课 -〔Tony Bai〕

网络排查案例课 -〔杨胜辉〕

高并发系统实战课 -〔徐长龙〕

互联网人的数字化企业生存指南 -〔沈欣〕

好记忆不如烂笔头。留下您的足迹吧 :)