3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php Array ( [0] => Array ( [name] => Bank BRI [amount] => 0 ) [1] => Array ( [name] => Bank BRI [amount] => 0 ) [2] => Array ( [name] => Bank BCA [amount] => 1412341234 ) [3] => Array ( [name] => Bank CIMB Niaga [amount] => 532532552 ) [4] => Array ( [name] => Bank BRI [amount] => 34534534 ) [5] => Array ( [name] => Bank CIMB Niaga [amount] => 453425243 ) [6] => Array ( [name] => Bank BRI [amount] => 0 ) [7] => Array ( [name] => Bank BNI [amount] => 124124 ) [8] => Array ( [name] => Bank CIMB Niaga [amount] => 352345623 ) [9] => Array ( [name] => Bank BCA [amount] => 23432423 ) [10] => Array ( [name] => Bank Mandiri [amount] => 0 ) [11] => Array ( [name] => Bank BCA [amount] => 0 ) [12] => Array ( [name] => Bank BCA [amount] => 0 ) [13] => Array ( [name] => Bank Permata [amount] => 352352353 ) ) $totals = array(); foreach ($banks AS $bank) { if (!isset($totals[$bank['name']])) $totals[$bank['name']] = 0; $totals[$bank['name']] += $bank['amount']; }
Output for 5.4.0 - 5.4.32
Parse error: syntax error, unexpected 'BRI' (T_STRING), expecting ')' in /in/bA5FN on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/bA5FN on line 3
Process exited with code 255.