我有以下相当简单的代码,其中我需要确定是否在一个阵列中存在一定值:问题与in_array
$testvalue = $_GET['testvalue']; // 4
$list = '3, 4, 5';
$array = array($list);
if (in_array($testvalue, $array)) { // Code if found } else { // Code if not found }
尽管很明显,数字4是阵列中,所述代码返回else支架内的代码。我做错了什么?
可能把字符串作为3,4,5 1个字符串数组中 – 2012-08-13 20:07:12