这是数组:
$campaigns = Array ( [252] =>Array ( [campaign_type_id] => 9 [company] => Array ( [company_name] => facebook [company_type] => 2 ) [campaign] => Array( [pitch_id] => 27 [pitch_campaign_title] => facebook mandate [pitch_campaign_description] => desc face [pitch_campaign_image] => db.png ) [title] => Accelarator [selection] => Array ( [0] => Array( [ca_mandate_id] => 96 [ca_id] => 252 [ca_company_id] => 1 [ca_updated] => 2015-12-31 12:37:50 ) ) [campaign_created_by] => 3 [userinfo] => Array ( [0] => Array ( [user_id] => 3 [user_first_name] => CoLabs [user_last_name] => Accelerator [user_img] => index2.jpg [user_designation_name] => Investor [user_company_id] => 123 ) ) ) )
我怎样才能得到'252'的值?它是一个动态的价值.我希望得到任何存储的值代替252.
请帮忙?
提前致谢.
使用array_keys函数:http://php.net/array_keys
array_keys - 返回数组的所有键或键的子集
描述 array array_keys(array $ array [,mixed $ search_value = null [,bool $ strict = false]])
对于你的代码:
$keys = array_keys($campaigns);