-2
我陣列字符串「病人」是:我如何檢查使用in_array在PHP
$com_arr = Array(
[0] => patient
[1] => novel
[2] => name
[3] => monkey
[4] => yourself
[5] => novel
[6] => buttons
[7] => fifth
[8] => stories
[9] => English
[10] => sign
[11] => children
)
和可變$values_for_ex[$r-1] = patient
和我的函數看起來像
if(in_array($values_for_ex[$r-1] ,$com_arr)) {
$replacements1 = "<span style='color:green;font-weight:700;' id='s'>"
. $values_for_ex[$r-1] . "</span>";
}
,但條件是行不通的。爲什麼?
$ r來自哪裏提供一些更多信息 – peter
PHP ** in_array **搜索是**區分大小寫**請檢查兩個值是否相同 –