title: how to make a foreach loop for more array than 1
body: <p>I need to insert a mass load of data from 4 different arrays into my database, but I can't figure out how to make a foreach loop for this.</p>
  
  <p>This is a shortened vesion of my script (don't mind the unfinished query).</p>
  
  <p>code:</p>
  
  <pre><code>$latitudeArray = array(
      array('latitude'=&gt;'52.37124908')
  );
  
  $longtitudeArray = array(
      array('longtitude'=&gt;'4.893587136')
  );
  
  $bodyArray = array(
      array('body'=&gt;'Waterplastiek: een halfronde vorm met treden waaruit water stroomt naar een in de bestrating uitgeholde granieten goot.')
  );
  
  $titleArray = array(
      array('title'=&gt;'ReNESsance-fontein (Nes 45, op plein voor Vlaams Cultureel Centrum, Theater De Brakke Grond)')
  );
  
  $mysqli = new MySQLi("localhost", "root", "", "po");
  if ($mysqli-&gt;connect_errno) {
      echo "Failed to connect to MySQL: ({$mysqli-&gt;connect_errno}) {$mysqli-&gt;connect_error}";
  }
  // The first part of the SQL query
  $query = "INSERT INTO `markers` (`name`, `address`, `lat`, `lng`, `type`, `desc`) VALUES (``,``,``,``,``,``)";
  
  // This is the format of a VALUES tuple; it is used
  // below in sprintf()
  $format = " ('%s', '%s', '%s', '%s', %f, %f),";
  
  // Go over each array item and append it to the SQL query
  foreach(array_combine($titleArray,$bodyArray,$latitudeArray) as ) {
      $query .= sprintf(
          $format,
          $mysqli-&gt;escape_string($price['PriceDate']),
          $mysqli-&gt;escape_string($price['Fund']),
          $mysqli-&gt;escape_string($price['Currency']),
          $mysqli-&gt;escape_string($price['Class']),
          $mysqli-&gt;escape_string($price['NAV']),
          $mysqli-&gt;escape_string($price['NavChange'])
      );
  }
  // The last VALUES tuple has a trailing comma which will cause
  // problems, so let us remove it
  $query = rtrim($query, ',');
  
  // MySQLi::query returns boolean for INSERT
  $result = $mysqli-&gt;query($query);
  
  if ($result == false) {
      die("The query did not work: {$mysqli-&gt;error}");
  } else {
      die("The query was a success!");
  }
  </code></pre>