Created
May 12, 2017 14:41
-
-
Save cjzeven/7e3f209b47f954acca969b8fdf77c9df to your computer and use it in GitHub Desktop.
Reassign nilai baru ke variabel
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; | |
} | |
// Saya re-assign nilai baru | |
$value = 3; | |
echo implode(', ', $arr), "\n"; | |
// Hasil: | |
// 2, 4, 6, 8, 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment