溫馨提示×

如何在php中使用contains方法

PHP
小樊
101
2024-08-15 01:32:36
欄目: 編程語言

在PHP中,可以使用strpos函數來檢查一個字符串是否包含另一個字符串。例如:

$string = "Hello, world!";
$search = "world";

if (strpos($string, $search) !== false) {
    echo "The string contains the search term.";
} else {
    echo "The string does not contain the search term.";
}

這段代碼會檢查$string中是否包含$search,如果包含則輸出"The string contains the search term.“,否則輸出"The string does not contain the search term.”。

0
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女