|
|
|
รบกวนถามพี่ๆ เรื่องการจัดการอาเรย์บน php หน่อยครับ |
|
|
|
|
|
|
|
Code (PHP)
<?
$X = array(A,B,C);
$Y = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
$Z = array();
$i=0;
foreach ($Y as $tmp) {
$Z[] = $X[$i];
$i++;
if($i==count($X))
{
$i=0;
}
}
print_r($Z);
?>
Result
Array ( [0] => A [1] => B [2] => C [3] => A [4] => B [5] => C [6] => A [7] => B [8] => C [9] => A [10] => B [11] => C [12] => A [13] => B [14] => C )
|
|
|
|
|
Date :
2012-03-10 08:42:27 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|