savagenoob Posted October 5, 2011 Share Posted October 5, 2011 I have an array that looks like : Array ( [0] => Array ( [0] => Blah Blah INSURANCE [1] => PO BOX 111 [2] => MERCED, CA 91111 [3] => Phone: (111) 111-1111 [4] => Fax: (111) 111-1111 [5] => blah IT [6] => PO BOX 3231 (9111) [7] => MODESTO, CA 11111 [8] => Phone: (111) 111-1111 [9] => Fax: (111) 511-1111 [10] => Blah INSURANCE AGENCY, INC [11] => PO BOX 111 (91111 [12] => TURLOCK, CA 11111 [13] => Phone: (209) 111-1111 [14] => Fax: (209) 111-1111 and need to convert this to display seperately in a table like: Business NameAddressPhone Number without the fax, how can this be accomplished. Quote Link to comment https://forums.phpfreaks.com/topic/248512-array-help/ Share on other sites More sharing options...
mike12255 Posted October 5, 2011 Share Posted October 5, 2011 so basically you want to put all this information in a table except for the "Fax" value? do all of your arrays have the same number of elements in them? Quote Link to comment https://forums.phpfreaks.com/topic/248512-array-help/#findComment-1276214 Share on other sites More sharing options...
savagenoob Posted October 5, 2011 Author Share Posted October 5, 2011 Im screen scraping a webpage using curl then pulling the business data from the html. The number of array entries would be determined by the zip code entered. But every entry will have 1.the business name 2. street address 3. city state zip 4. phone 5. fax in that order for every entry. Quote Link to comment https://forums.phpfreaks.com/topic/248512-array-help/#findComment-1276222 Share on other sites More sharing options...
requinix Posted October 5, 2011 Share Posted October 5, 2011 for ($i = 0; $i $name = $array[$i]; $address = $array[$i + 1]; $location = $array[$i + 2]; $phone = $array[$i + 3]; // ... } Who are you scraping? Why? Do they know you're doing this? Quote Link to comment https://forums.phpfreaks.com/topic/248512-array-help/#findComment-1276226 Share on other sites More sharing options...
savagenoob Posted October 5, 2011 Author Share Posted October 5, 2011 Thank you, I couldnt figure out that foreach loop. Quote Link to comment https://forums.phpfreaks.com/topic/248512-array-help/#findComment-1276259 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.