3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array(Array('b','d'), Array('c','a'), Array('b','d'), Array('a','d'), Array('c'), Array('c'), Array('a','d','e'), Array('d','b') ); $occur = array(); foreach ($array as $item) { foreach ($item as $k => $v) { $occur["$k == $v"]++; } } print_r($occur);
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined index: 0 == b in /in/P1KpC on line 14 Notice: Undefined index: 1 == d in /in/P1KpC on line 14 Notice: Undefined index: 0 == c in /in/P1KpC on line 14 Notice: Undefined index: 1 == a in /in/P1KpC on line 14 Notice: Undefined index: 0 == a in /in/P1KpC on line 14 Notice: Undefined index: 2 == e in /in/P1KpC on line 14 Notice: Undefined index: 0 == d in /in/P1KpC on line 14 Notice: Undefined index: 1 == b in /in/P1KpC on line 14 Array ( [0 == b] => 2 [1 == d] => 4 [0 == c] => 3 [1 == a] => 1 [0 == a] => 2 [2 == e] => 1 [0 == d] => 1 [1 == b] => 1 )
Output for hhvm-3.10.0 - 3.12.0
Array ( [0 == b] => 2 [1 == d] => 4 [0 == c] => 3 [1 == a] => 1 [0 == a] => 2 [2 == e] => 1 [0 == d] => 1 [1 == b] => 1 )
Output for 4.3.0 - 5.2.17
Notice: Undefined index: 0 == b in /in/P1KpC on line 14 Notice: Undefined index: 1 == d in /in/P1KpC on line 14 Notice: Undefined index: 0 == c in /in/P1KpC on line 14 Notice: Undefined index: 1 == a in /in/P1KpC on line 14 Notice: Undefined index: 0 == a in /in/P1KpC on line 14 Notice: Undefined index: 2 == e in /in/P1KpC on line 14 Notice: Undefined index: 0 == d in /in/P1KpC on line 14 Notice: Undefined index: 1 == b in /in/P1KpC on line 14 Array ( [0 == b] => 2 [1 == d] => 4 [0 == c] => 3 [1 == a] => 1 [0 == a] => 2 [2 == e] => 1 [0 == d] => 1 [1 == b] => 1 )