Jump to content

Recommended Posts

Hello,

 

I'm fairly new to PHP and trying to add a url from a multidimensional array.

 

I've used the print_r function to get the following:

 

Array ( [0] => Array ( [residential] => Array ( [mls] => 128406 [ts] => 0 [type] => R [area] => East [price] => 102000 [number] => 1836 [direction] => E [address] => 17th St [city] => Pueblo [state] => CO [zip] => 81001 [bedrooms] => 3 [bathrooms] => 2 [style] => Ranch [garage] => No Garage [basement] => Full Basement, Completely Finished [fireplace] => 0 [above_sqft] => 768 [total_gross_sqft] => 1536 [zoning] => R-2 [year_built] => 1977 [taxes] => 520.00 [tax_year] => 2009 [sqft_source] => Court House [master_bdrm_level] => M [master_bdrm_size] => 10x13 [bdrm2_level] => M [bdrm2_size] => 10x9 [bdrm3_level] => B [bdrm3_size] => 10x9 [bdrm4_level] => [bdrm4_size] => [bdrm5_level] => [bdrm5_size] => [kitchen_level] => M [kitchen_size] => 11x10 [kitchen_eating] => [dining_level] => [dining_size] => [dining_type] => [living_level] => M [living_size] => 10x15 [family_level] => M [family_size] => 10x20 [remarks] => Cute home with finished basement on a corner lot. Tile floors, new windows, and very well kept. [int_features] => Tile Floors, Ceiling Fan(s) [ext_features] => Paved Street, Shed, Corner Lot [office] => 117 [agent] => 316 [sub_area] => Eastside [school_district] => 60 [virtual_tour] => marketing.remaxdesigncenter.com/39/27439/1134153/index.ipv [laundry_level] => ) [i] => Array ( [imageId] => 134457 [mls] => 128406 [imgUrl] => http://tp.usamls.net/getMLPhoto.asp?l=8C5B5A988C6194717B869C8A70B2B9908C6F895A8C586C8D64 [label] => Main View [dateModified] => 2010-03-15 18:16:44 [photoOrder] => 0 [portrait] => False ) ) [1] => Array ( [residential] => Array ( [mls] => 125151 [ts] => 0 [type] => R [area] => South [price] => 117900 [number] => 2581 [direction] => [address] => Hyacinth St [city] => Pueblo [state] => CO [zip] => 81005 [bedrooms] => 4 [bathrooms] => 2 [style] => Ranch [garage] => 1 Car Garage Attached [basement] => Full Basement [fireplace] => 0 [above_sqft] => 960 [total_gross_sqft] => 1920 [zoning] => R-2 [year_built] => 1958 [taxes] => 868.82 [tax_year] => 2008 [sqft_source] => Court House [master_bdrm_level] => B [master_bdrm_size] => 14x13 [bdrm2_level] => M [bdrm2_size] => 11x10 [bdrm3_level] => M [bdrm3_size] => 11x9 [bdrm4_level] => M [bdrm4_size] => 8x10 [bdrm5_level] => [bdrm5_size] => [kitchen_level] => M [kitchen_size] => 11x7 [kitchen_eating] => [dining_level] => M [dining_size] => 8x7 [dining_type] => [living_level] => M [living_size] => 17x14 [family_level] => [family_size] => [remarks] => Nice home with hardwood floors in bedrooms under carpet. Master bedroom in basement, beautiful backyard with covered patio. 2 rooms in basement are listed as other rooms, they are non-conforming. [int_features] => None [ext_features] => Paved Street [office] => 117 [agent] => 316 [sub_area] => Highland Park [school_district] => 60 [virtual_tour] => [laundry_level] => ) [i] => Array ( [imageId] => 107269 [mls] => 125151 [imgUrl] => http://tp.usamls.net/getMLPhoto.asp?l=8C5B5A988C61916E80819C8A70B2B9908C6F895A8C586C8D64 [label] => Main View [dateModified] => 2009-08-05 18:11:39 [photoOrder] => 0 [portrait] => False ) ) [2] => Array ( [residential] => Array ( [mls] => 129047 [ts] => 0 [type] => R [area] => Pueblo West [price] => 239000 [number] => 348 [direction] => S [address] => Littler Dr [city] => Pueblo West [state] => CO [zip] => 81007 [bedrooms] => 3 [bathrooms] => 3 [style] => Ranch [garage] => 3 Car Garage Attached [basement] => No Basement, Crawl Space [fireplace] => 1 [above_sqft] => 2358 [total_gross_sqft] => 2358 [zoning] => R-2 [year_built] => 1997 [taxes] => 1864.00 [tax_year] => 2009 [sqft_source] => Appraisal [master_bdrm_level] => M [master_bdrm_size] => 13x17 [bdrm2_level] => M [bdrm2_size] => 12x12 [bdrm3_level] => M [bdrm3_size] => 12x10 [bdrm4_level] => [bdrm4_size] => [bdrm5_level] => [bdrm5_size] => [kitchen_level] => M [kitchen_size] => 14x17 [kitchen_eating] => [dining_level] => M [dining_size] => 12x13 [dining_type] => [living_level] => M [living_size] => 14x12 [family_level] => M [family_size] => 13x17 [remarks] => Nice house in golf course area of PW. Everything on one level, nice yard with gazebo. Pictures are from when seller occupied property. [int_features] => Hardwood Floors, Tile Floors [ext_features] => Paved Street, RV Parking [office] => 117 [agent] => 316 [sub_area] => Pueblo West Golf Course [school_district] => 70 [virtual_tour] => [laundry_level] => ) [i] => Array ( [imageId] => 139992 [mls] => 129047 [imgUrl] => http://tp.usamls.net/getMLPhoto.asp?l=8C5B5A988C61956D7F879C8A70B2B9908C6F895A8C586C8D64 [label] => Main View [dateModified] => 2010-04-19 18:07:21 [photoOrder] => 0 [portrait] => False ) ) ) 1

 

I thought the following would return the imgUrl, but it doesn't:

<img src="<?php echo $images[0]['residential']['imgUrl']; ?>">

Link to comment
https://forums.phpfreaks.com/topic/202221-get-value-from-multidimensional-array/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.