2 dimensional array

Posted by ankit on Stack Overflow See other posts from Stack Overflow or by ankit
Published on 2010-05-05T09:05:39Z Indexed on 2010/05/05 9:08 UTC
Read the original article Hit count: 213

Filed under:

we have these arrays....

$cities = array("nagpur","kanpur","delhi","chd","Noida","mumbai","nagpur");
$names = array("munish","imteyaz","ram","shyam","ankit","Rahul","mohan");

now i want a 2 dimensional array with name of city as key and all the corresponding names as its values.

$cities = array("nagpur","kanpur","nagpur","delhi","kanpur");
$names = array("ankit","atul","aman","amit","manu");
foreach ($cities as $i => $value) {
 echo "\n";

 echo $value;
 foreach ($cities as $ii => $m) {
  echo$names[$ii] ;

  $arr = array($city => array($k =>$names[$ii] ));


wat i tried is this.but it doesnt work.help me

© Stack Overflow or respective owner

Related posts about php

Related posts about multidimensional-array