Created
November 12, 2013 19:46
-
-
Save angch/7437437 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Use proper tags, not everyone is coding in PHP! | |
// Use proper, *working* code please. Not everyone wants to retype your homework. | |
$tahun = array(2011, 2012, 2013); | |
$nama = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'); | |
// Homework: Go read and understand: | |
// http://php.net/manual/en/ref.array.php | |
// Formatted for readability | |
$nama2 = array_fill(0, sizeof($tahun), array()); | |
$i = 0; | |
foreach ($nama as $n) { | |
$nama2[$i++][] = $n; | |
$i = $i >= sizeof($tahun) ? 0 : $i; | |
} | |
print_r($nama2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment