chonk Posted March 1, 2013 Share Posted March 1, 2013 I have a form that spits out an array with the code - print_r($result); This outputs the following: Array( [0] => stdClass Object ( [input_index] => 0 [candidate_index] => 0 [delivery_line_1] => 5259 N Elderberry Ct SE [last_line] => Kentwood MI 49512-9693 [delivery_point_barcode] => 495129693598 [components] => stdClass Object ( [primary_number] => 5259 [street_predirection] => N [street_name] => Elderberry [street_postdirection] => SE [street_suffix] => Ct [city_name] => Kentwood [state_abbreviation] => MI [zipcode] => 49512 [plus4_code] => 9693 [delivery_point] => 59 [delivery_point_check_digit] => 8 ) [metadata] => stdClass Object ( [record_type] => S [county_fips] => 26081 [county_name] => Kent [carrier_route] => R087 [congressional_district] => 02 [rdi] => Residential [latitude] => 42.868 [longitude] => -85.57536 [precision] => Zip9 ) [analysis] => stdClass Object ( [dpv_match_code] => Y [dpv_footnotes] => AABB [dpv_cmra] => N [dpv_vacant] => N [active] => Y [footnotes] => N# ) )) I need to assign the [rdi] value to a variable. How do I access that spot in the array with PHP? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/275100-output-variable-in-multi-dimension-array/ Share on other sites More sharing options...
Solution teynon Posted March 1, 2013 Solution Share Posted March 1, 2013 $myvar[0]->metadata->rdi Quote Link to comment https://forums.phpfreaks.com/topic/275100-output-variable-in-multi-dimension-array/#findComment-1415913 Share on other sites More sharing options...
chonk Posted March 2, 2013 Author Share Posted March 2, 2013 (edited) Thanks you. Edited March 2, 2013 by chonk Quote Link to comment https://forums.phpfreaks.com/topic/275100-output-variable-in-multi-dimension-array/#findComment-1416047 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.