我想从长数组值中获取字符串。如何从数组中获得值
例如
$array[1]='this is a good day. The number:1, class:math';
$array[2]='this is a bad day. The number:2, class:english';
$array[3]='this is a fine day. The number:3, class:physics';
我想要得到的number:1
或class:math
字符串从数组中。
我试图
echo array_search('number:1',$array);
,但它给了我什么。我想知道是否有更好的方法来做到这一点。非常感谢!
你读过[documentation](http://us3.php.net/manual/en/function.array-search.php)了吗? – 2012-08-03 18:11:58
'array_search'搜索数组元素,而不是数组元素中的字符串内容。你是否试图找到包含*某个键/值对*的*元素*,或者你是否试图找到*某个元素中某个键的值*? – 2012-08-03 18:12:27
那么,你到底在做什么呢?你想要什么回来? – 2012-08-03 18:14:39