3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function penjumlahan($data_angka) { $hasil = 0; foreach($data_angka as $index => $value) { $hasil = $hasil + $value; } return $hasil; } $kumpulan_angka = array(3,5,7,8,9); $hasil = penjumlahan($kumpulan_angka); echo $hasil; function tukarData($data_a, $data_b) { $data_c = $data_a; $data_a = $data_b; $data_b = $data_c; return array($data_a, $data_b); } $data_a = "Teh"; $data_b = "Susu"; $hasil_tukar = tukarData($data_a, $data_b); $hasil_tukar[0] = $data_a; $hasil_tukar[1] = $data_b; echo $hasil_tukar; echo $data_a; echo $data_b;
based on pt3Vi
Output for 5.4.0 - 7.2.0
32 Notice: Array to string conversion in /in/MUv9C on line 29 ArrayTehSusu
Output for 4.3.0 - 5.3.29
32ArrayTehSusu