Friday 15 February 2013

php - how to get element from this array -



php - how to get element from this array -

this question has reply here:

able see variable in print_r()'s output, not sure how access in code 7 answers

i want info array.i have 2 sub-arrays in array. 1 @ position [0] , @ ['header_data']. able extract [0] subscript elements don't know how ['header_data'] elements. code given below :

foreach ($result $index) { $resultarr[] = explode(' ', $index[0][0]); } //$valuesarr = array(); foreach ($resultarr $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'] );

output here :

array ( [0] => array ( [0] => kishor [1] =>bisal@gjjil.com [2]=> 845678956 ) [header_data] => array ( [date] => sun, 5 oct 2014 15:10:17 +0580 [subject] => advertisement response dealer profile ) )

you can access associative array this:

$arr['header_data']['date'] $arr['header_data']['subject']

php arrays

No comments:

Post a Comment