[ create a new paste ] login | about

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

PHP, pasted on May 5:
<?php

$firstArray = array("Leaves-19", "Shifts-5", "Shifts-1", "Shifts-1", "Shifts-1", "Shifts-1", "Leaves-19", "Leaves-19", "Shifts-1", "Shifts-1", "Shifts-1", "Shifts-1", "Shifts-1", "Leaves-19", "Leaves-19", "Shifts-1", "Shifts-1", "Shifts-1", "Shifts-1", "Shifts-1", "Leaves-19", "Leaves-19", "Shifts-1", "Shifts-1", "Shifts-1", "Shifts-1", "Shifts-1", "Leaves-19", "Leaves-19", "Shifts-1", "Shifts-1", "Shifts-1", "Shifts-1", "Shifts-1", "Leaves-19", "Leaves-19", "Shifts-1", "Shifts-1", "Shifts-1", "Shifts-1", "Shifts-1", "Leaves-19");

$secondArray = array("2013-04-28", "2013-04-29", "2013-04-30", "2013-05-01", "2013-05-02", "2013-05-03", "2013-05-04");

$thirdArray = array("13", "10", "12", "9", "14", "11");


$datesCount        = count( $secondArray );
$firstArrayLength  = count( $firstArray );
$thirdArrayLength  = count( $thirdArray );

$firstArrayIndex=0;

for( $i=0 ; $i < $thirdArrayLength ; $i++ )
{
    $currentThirdArrayValue = $thirdArray[$i];

    for( $inner=0 ; $inner < $datesCount ; $inner++, $firstArrayIndex++ )
    {
        if( $firstArrayIndex == $firstArrayLength )
                $firstArrayIndex = 0;

        echo "{$secondArray[$inner]} / {$currentThirdArrayValue} / {$firstArray[$firstArrayIndex]}<br/>\n";
    }
}

?>


Output:
2013-04-28 / 13 / Leaves-19<br/>
2013-04-29 / 13 / Shifts-5<br/>
2013-04-30 / 13 / Shifts-1<br/>
2013-05-01 / 13 / Shifts-1<br/>
2013-05-02 / 13 / Shifts-1<br/>
2013-05-03 / 13 / Shifts-1<br/>
2013-05-04 / 13 / Leaves-19<br/>
2013-04-28 / 10 / Leaves-19<br/>
2013-04-29 / 10 / Shifts-1<br/>
2013-04-30 / 10 / Shifts-1<br/>
2013-05-01 / 10 / Shifts-1<br/>
2013-05-02 / 10 / Shifts-1<br/>
2013-05-03 / 10 / Shifts-1<br/>
2013-05-04 / 10 / Leaves-19<br/>
2013-04-28 / 12 / Leaves-19<br/>
2013-04-29 / 12 / Shifts-1<br/>
2013-04-30 / 12 / Shifts-1<br/>
2013-05-01 / 12 / Shifts-1<br/>
2013-05-02 / 12 / Shifts-1<br/>
2013-05-03 / 12 / Shifts-1<br/>
2013-05-04 / 12 / Leaves-19<br/>
2013-04-28 / 9 / Leaves-19<br/>
2013-04-29 / 9 / Shifts-1<br/>
2013-04-30 / 9 / Shifts-1<br/>
2013-05-01 / 9 / Shifts-1<br/>
2013-05-02 / 9 / Shifts-1<br/>
2013-05-03 / 9 / Shifts-1<br/>
2013-05-04 / 9 / Leaves-19<br/>
2013-04-28 / 14 / Leaves-19<br/>
2013-04-29 / 14 / Shifts-1<br/>
2013-04-30 / 14 / Shifts-1<br/>
2013-05-01 / 14 / Shifts-1<br/>
2013-05-02 / 14 / Shifts-1<br/>
2013-05-03 / 14 / Shifts-1<br/>
2013-05-04 / 14 / Leaves-19<br/>
2013-04-28 / 11 / Leaves-19<br/>
2013-04-29 / 11 / Shifts-1<br/>
2013-04-30 / 11 / Shifts-1<br/>
2013-05-01 / 11 / Shifts-1<br/>
2013-05-02 / 11 / Shifts-1<br/>
2013-05-03 / 11 / Shifts-1<br/>
2013-05-04 / 11 / Leaves-19<br/>


Create a new paste based on this one


Comments: