Last active
May 12, 2017 14:33
-
-
Save cjzeven/74f42a10c258c997b462ab79093e4496 to your computer and use it in GitHub Desktop.
Mengalikan setiap elemen array
This file contains 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 | |
$arr = [1, 2, 3, 4, 5]; | |
foreach($arr as &$value) { | |
$value = $value * 2; | |
} | |
echo implode(', ', $arr), "\n"; | |
// Hasil: | |
// 2, 4, 6, 8, 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment