Skip to content

Instantly share code, notes, and snippets.

@cjzeven
Last active May 12, 2017 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjzeven/74f42a10c258c997b462ab79093e4496 to your computer and use it in GitHub Desktop.
Save cjzeven/74f42a10c258c997b462ab79093e4496 to your computer and use it in GitHub Desktop.
Mengalikan setiap elemen array
<?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