我試圖讓strpos
正常工作。匹配值的問題
如果$monthly_cost
和$phone
包含在$string
中,則返回true。
<?php
$monthly_cost = 25;
$phone = "iPhone";
$string = "iPhone £25 24m Upgrade";
if (strpos($string, $phone) && strpos($string, $monthly_cost)) {
echo "found";
}
?>
還是使用正則表達式更好?
嗯,沒有工作? – user622378 2011-05-16 12:32:49
@user:將這個'$ monthly_cost = 25;'更改爲'$ monthly_cost ='25';' – 2011-05-16 12:38:57