-2
我想從數組中獲取數據。在該數組中有兩個子數組。一個位於[0]
,另一個位於['header_data']
。最初我能夠提取[0]
下標元素,但不知道如何獲得['header_data']
元素。下面的代碼給出:如何從這個數組中獲取元素
foreach ($result as $index) {
$resultArr[] = explode(' ', $index[0][0]);
}
//$valuesArr = array();
foreach ($resultArr as $value) {
$arrayVal = array("lead_source" => "ABC",
"name" => trim(strip_tags(str_replace(array('Name : ', '(Dealer)'), '', $value[0]))),
"emailId" => trim(strip_tags(str_replace(array('Email : ', 'Verified'), '', $value[1]))),
"contactNo" => trim(strip_tags(str_replace(array('Phone number : ', ' Verified'), '', $value[2]))),
"project_name" => " ",
"customer_query" => "",
"description" => "",
"locality" => "",
"budget" => "",
"date" => $index['header_data']['date'],
"subject" => $index['header_data']['subject']
);
輸出是在這裏:
Array
(
[0] => Array
(
[0] => Kishor
[1] =>[email protected]
[2]=> 845678956
)
[header_data] => Array
(
[date] => Sun, 5 Oct 2014 15:10:17 +0580
[subject] => Advertisement Response for Dealer profile
)
)
嗯,'$ arr ['header_data'] ['date']'? – 2014-10-26 13:55:21