0
這個搜索是我的$陣列的結果:PHP陣specfic值
Array ([row] => Array ([Field] => product_id [Type] => int(11) [Null] => NO [Key] => PRI [Default] => [Extra] => auto_increment) [rows] => Array ([0] => Array ([Field] => product_id [Type] => int(11) [Null] => NO [Key] => PRI [Default] => [Extra] => auto_increment) [1] => Array ([Field] => model [Type] => varchar(64) [Null] => NO [Key] => [Default] => [Extra] =>) [2] => Array ([Field] => sku [Type] => varchar(64) [Null] => NO [Key] => [Default] => [Extra] =>) [3] => Array ([Field] => upc [Type] => varchar(12) [Null] => NO [Key] => [Default] => [Extra] =>) [4] => Array ([Field] => ean [Type] => varchar(14) [Null] => NO [Key] => [Default] => [Extra] =>) [5] => Array ([Field] => jan [Type] => varchar(13) [Null] => NO [Key] => [Default] => [Extra] =>) [6] => Array ([Field] => isbn [Type] => varchar(13) [Null] => NO [Key] => [Default] => [Extra] =>) [7] => Array ([Field] => mpn [Type] => varchar(64) [Null] => NO [Key] => [Default] => [Extra] =>) [8] => Array ([Field] => location [Type] => varchar(128) [Null] => NO [Key] => [Default] => [Extra] =>) [9] => Array ([Field] => quantity [Type] => int(4) [Null] => NO [Key] => [Default] => 0 [Extra] =>) [10] => Array ([Field] => stock_status_id [Type] => int(11) [Null] => NO [Key] => [Default] => [Extra] =>) [11] => Array ([Field] => image [Type] => varchar(255) [Null] => YES [Key] => [Default] => [Extra] =>) [12] => Array ([Field] => manufacturer_id [Type] => int(11) [Null] => NO [Key] => [Default] => [Extra] =>) [13] => Array ([Field] => shipping [Type] => tinyint(1) [Null] => NO [Key] => [Default] => 1 [Extra] =>) [14] => Array ([Field] => price [Type] => decimal(15,4) [Null] => NO [Key] => [Default] => 0.0000 [Extra] =>) [15] => Array ([Field] => points [Type] => int(8) [Null] => NO [Key] => [Default] => 0 [Extra] =>) [16] => Array ([Field] => tax_class_id [Type] => int(11) [Null] => NO [Key] => [Default] => [Extra] =>) [17] => Array ([Field] => date_available [Type] => date [Null] => NO [Key] => [Default] => [Extra] =>) [18] => Array ([Field] => weight [Type] => decimal(15,8) [Null] => NO [Key] => [Default] => 0.00000000 [Extra] =>) [19] => Array ([Field] => weight_class_id [Type] => int(11) [Null] => NO [Key] => [Default] => 0 [Extra] =>) [20] => Array ([Field] => length [Type] => decimal(15,8) [Null] => NO [Key] => [Default] => 0.00000000 [Extra] =>) [21] => Array ([Field] => width [Type] => decimal(15,8) [Null] => NO [Key] => [Default] => 0.00000000 [Extra] =>) [22] => Array ([Field] => height [Type] => decimal(15,8) [Null] => NO [Key] => [Default] => 0.00000000 [Extra] =>) [23] => Array ([Field] => length_class_id [Type] => int(11) [Null] => NO [Key] => [Default] => 0 [Extra] =>) [24] => Array ([Field] => subtract [Type] => tinyint(1) [Null] => NO [Key] => [Default] => 1 [Extra] =>) [25] => Array ([Field] => minimum [Type] => int(11) [Null] => NO [Key] => [Default] => 1 [Extra] =>) [26] => Array ([Field] => sort_order [Type] => int(11) [Null] => NO [Key] => [Default] => 0 [Extra] =>) [27] => Array ([Field] => status [Type] => tinyint(1) [Null] => NO [Key] => [Default] => 0 [Extra] =>) [28] => Array ([Field] => serial [Type] => tinyint(1) [Null] => NO [Key] => [Default] => 0 [Extra] =>) [29] => Array ([Field] => serialn [Type] => varchar(64) [Null] => NO [Key] => [Default] => [Extra] =>) [30] => Array ([Field] => date_added [Type] => datetime [Null] => NO [Key] => [Default] => 0000-00-00 00:00:00 [Extra] =>) [31] => Array ([Field] => date_modified [Type] => datetime [Null] => NO [Key] => [Default] => 0000-00-00 00:00:00 [Extra] =>) [32] => Array ([Field] => viewed [Type] => int(5) [Null] => NO [Key] => [Default] => 0 [Extra] =>)) [num_rows] => 33)
我如何搜索「串行」,一旦發現做一些事情,如果它沒有找到,那麼做點別的?
我已經試過這
if(array_search('serial',$array)) { echo "hello"; } else { echo "heheheh";}
,它只是不會做我想做的事情?
'serial'處於子陣列的值。因此,'array_search()'本身不起作用。 – 2013-04-29 21:29:58
http://stackoverflow.com/questions/2693310/search-for-values-in-nested-array – nullability 2013-04-29 21:30:50