Home  >  Article  >  Backend Development  >  php简单判断两个字符串是否相等的方法

php简单判断两个字符串是否相等的方法

PHPz
PHPzOriginal
2016-05-16 20:10:572603browse

这篇文章主要介绍了php简单判断两个字符串是否相等的方法,涉及php针对字符串操作的相关技巧,具有一定参考借鉴价值,需要的朋友可以参考下

<?php 
function strcomp($str1,$str2){ 
  if($str1 == $str2){ 
    return TRUE; 
  }else{ 
    return FALSE; 
  } 
} 
echo strcomp("First string","Second string");
//Returns FALSE 
echo strcomp("A string","A string");
//Returns TRUE 
?>

更多相关教程请访问 php编程从入门到精通全套视频教程

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn