Instantly share code, notes, and snippets.

Embed
What would you like to do?
Reassign nilai baru ke variabel
<?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