网络营销电子商务研究中心

网络营销电子商务研究中心 (https://www.0058.net/index.php)
-   PHP (https://www.0058.net/forumdisplay.php?f=75)
-   -   php一个简单的判断两个字符串是否相等 (https://www.0058.net/showthread.php?t=5434)

Parker Crossroads 2016-02-28 10:26 PM

php一个简单的判断两个字符串是否相等
 
简单的条件判断语句练习,判断两个字符串是否完全一样
Code:


<?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
?>



All times are GMT +8. The time now is 05:53 AM.

Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.