3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $data = [ ['chart_value' => 0], ['chart_value' => 1], ['chart_value' => 2], ['chart_value' => 3], ['chart_value' => 4], ['chart_value' => 5], ['chart_value' => 6], ['chart_value' => 0], ['chart_value' => 1], ['chart_value' => 2], ['chart_value' => 3], ['chart_value' => 4], ['chart_value' => 5], ['chart_value' => 6], ['chart_value' => 0], ['chart_value' => 1], ['chart_value' => 2], ['chart_value' => 3], ['chart_value' => 4], ['chart_value' => 5], ['chart_value' => 6], ['chart_value' => 0], ['chart_value' => 1], ['chart_value' => 2], ['chart_value' => 3], ['chart_value' => 4], ['chart_value' => 5], ['chart_value' => 6], ['chart_value' => 0], ['chart_value' => 1], ['chart_value' => 2], ['chart_value' => 3], ['chart_value' => 4], ['chart_value' => 5], ['chart_value' => 6], ['chart_value' => 0], ['chart_value' => 1], ['chart_value' => 2], ['chart_value' => 3], ['chart_value' => 4], ['chart_value' => 5], ['chart_value' => 6], ['chart_value' => 0], ['chart_value' => 1], ['chart_value' => 2], ['chart_value' => 3], ['chart_value' => 4], ['chart_value' => 5], ['chart_value' => 6], ['chart_value' => 0], ['chart_value' => 1], ['chart_value' => 2], ['chart_value' => 3], ['chart_value' => 4], ['chart_value' => 5], ['chart_value' => 6], ]; $x = array_chunk($data, 7, true); var_dump($x);
based on K9D7M
Output for 5.4.0 - 7.2.0
array(8) { [0]=> array(7) { [0]=> array(1) { ["chart_value"]=> int(0) } [1]=> array(1) { ["chart_value"]=> int(1) } [2]=> array(1) { ["chart_value"]=> int(2) } [3]=> array(1) { ["chart_value"]=> int(3) } [4]=> array(1) { ["chart_value"]=> int(4) } [5]=> array(1) { ["chart_value"]=> int(5) } [6]=> array(1) { ["chart_value"]=> int(6) } } [1]=> array(7) { [7]=> array(1) { ["chart_value"]=> int(0) } [8]=> array(1) { ["chart_value"]=> int(1) } [9]=> array(1) { ["chart_value"]=> int(2) } [10]=> array(1) { ["chart_value"]=> int(3) } [11]=> array(1) { ["chart_value"]=> int(4) } [12]=> array(1) { ["chart_value"]=> int(5) } [13]=> array(1) { ["chart_value"]=> int(6) } } [2]=> array(7) { [14]=> array(1) { ["chart_value"]=> int(0) } [15]=> array(1) { ["chart_value"]=> int(1) } [16]=> array(1) { ["chart_value"]=> int(2) } [17]=> array(1) { ["chart_value"]=> int(3) } [18]=> array(1) { ["chart_value"]=> int(4) } [19]=> array(1) { ["chart_value"]=> int(5) } [20]=> array(1) { ["chart_value"]=> int(6) } } [3]=> array(7) { [21]=> array(1) { ["chart_value"]=> int(0) } [22]=> array(1) { ["chart_value"]=> int(1) } [23]=> array(1) { ["chart_value"]=> int(2) } [24]=> array(1) { ["chart_value"]=> int(3) } [25]=> array(1) { ["chart_value"]=> int(4) } [26]=> array(1) { ["chart_value"]=> int(5) } [27]=> array(1) { ["chart_value"]=> int(6) } } [4]=> array(7) { [28]=> array(1) { ["chart_value"]=> int(0) } [29]=> array(1) { ["chart_value"]=> int(1) } [30]=> array(1) { ["chart_value"]=> int(2) } [31]=> array(1) { ["chart_value"]=> int(3) } [32]=> array(1) { ["chart_value"]=> int(4) } [33]=> array(1) { ["chart_value"]=> int(5) } [34]=> array(1) { ["chart_value"]=> int(6) } } [5]=> array(7) { [35]=> array(1) { ["chart_value"]=> int(0) } [36]=> array(1) { ["chart_value"]=> int(1) } [37]=> array(1) { ["chart_value"]=> int(2) } [38]=> array(1) { ["chart_value"]=> int(3) } [39]=> array(1) { ["chart_value"]=> int(4) } [40]=> array(1) { ["chart_value"]=> int(5) } [41]=> array(1) { ["chart_value"]=> int(6) } } [6]=> array(7) { [42]=> array(1) { ["chart_value"]=> int(0) } [43]=> array(1) { ["chart_value"]=> int(1) } [44]=> array(1) { ["chart_value"]=> int(2) } [45]=> array(1) { ["chart_value"]=> int(3) } [46]=> array(1) { ["chart_value"]=> int(4) } [47]=> array(1) { ["chart_value"]=> int(5) } [48]=> array(1) { ["chart_value"]=> int(6) } } [7]=> array(7) { [49]=> array(1) { ["chart_value"]=> int(0) } [50]=> array(1) { ["chart_value"]=> int(1) } [51]=> array(1) { ["chart_value"]=> int(2) } [52]=> array(1) { ["chart_value"]=> int(3) } [53]=> array(1) { ["chart_value"]=> int(4) } [54]=> array(1) { ["chart_value"]=> int(5) } [55]=> array(1) { ["chart_value"]=> int(6) } } }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/kevv1 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/kevv1 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/kevv1 on line 3
Process exited with code 255.