Generating arrays inside for loop

ertyiiwsr

New Member
I have the two following variables:\[code\]$contact_number=array('0123456','65321');$msg="My Text" ;\[/code\]I am trying to create an array like following using the above variables\[code\]$myarray =array( array("0" => "0123456", "1" => "My Text"), array("0" => "65321", "1" => "My Text") );\[/code\]I have tried the following code but it is not creating the exact array live above:\[code\]for($i=0; $i < count($contact_number); $i++ ) { $myarray[] =array(array("0" =>$contact_number[$i], "1" =>$msg),); } var_dump($myarray); \[/code\]Could you please tell me how to solve this problem
 
Top