[ create a new paste ] login | about

Link: http://codepad.org/yFvWs0Rh    [ raw code | output | fork ]

PHP, pasted on Jun 13:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php

$firstArr=array(array("1","test1"),array("8","test2"),array("9","test3"));


$secondArr=array("1","2","3");


$x=$y='';
foreach ($secondArr as $k=>$v){
$x.= str_repeat($firstArr[$k][0].',',$v);
$y.= str_repeat($firstArr[$k][1].',',$v);
}

echo rtrim($x,",").";\n";
echo rtrim($y,",").";";


Output:
1
2
1,8,8,9,9,9;
test1,test2,test2,test3,test3,test3;


Create a new paste based on this one


Comments: