Last active
May 12, 2017 16:53
-
-
Save cjzeven/057aff01d98e67cf5f0ee6703b91b260 to your computer and use it in GitHub Desktop.
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 | |
// Tampilkan nilai array | |
$arr = [1, 2, 3]; | |
echo implode(', ', $arr), "\n"; | |
// Melakukan looping untuk setiap elemen array | |
// menggunakan teknik passing by reference | |
foreach ($arr as &$value) {} | |
echo implode(', ', $arr), "\n"; | |
// Unset reference | |
unset($value); | |
// Melakukan looping untuk setiap elemen array | |
// menggunakan teknik passing by value | |
foreach ($arr as $value) {} | |
echo implode(', ', $arr), "\n"; | |
// Hasil: | |
// 1, 2, 3 | |
// 1, 2, 3 | |
// 1, 2, 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment