troubleshooting Question

Array for each question

Avatar of movieprodw
movieprodw asked on
4 Comments1 Solution407 ViewsLast Modified:

I am confused.

I made the following array and thought it would 'foreach' like I wrote it, but obviously I am very wrong.

Can you please help me fix it.

$hemdetails = array (
    "make"  => array("bmw", "bmw", "bmw", "bmw", "bmw"),
    "model"  => array("1600", "1602", "2002", "2002ti", "2002tii"),
    "minyear" => array("1960", "1960", "1960", "1960", "1960"),
    "maxyear"   => array("1980", "1980", "1980", "1980", "1980" )

$hemcollection[] = '';

foreach($hemdetails as $details){
      echo $details['make'].' '.$details['model'].' '.$details['minyear'].' '.$details['maxyear'];
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros