3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php for($i = 0;$i<60;$i++){ $array[] = $i; } $server = 2; var_dump($array); $items = floor(count($array)/3); echo $items; $array = array_splice($array,$items*$server,$items); var_dump($array);
Output for 4.3.0 - 7.2.0
array(60) { [0]=> int(0) [1]=> int(1) [2]=> int(2) [3]=> int(3) [4]=> int(4) [5]=> int(5) [6]=> int(6) [7]=> int(7) [8]=> int(8) [9]=> int(9) [10]=> int(10) [11]=> int(11) [12]=> int(12) [13]=> int(13) [14]=> int(14) [15]=> int(15) [16]=> int(16) [17]=> int(17) [18]=> int(18) [19]=> int(19) [20]=> int(20) [21]=> int(21) [22]=> int(22) [23]=> int(23) [24]=> int(24) [25]=> int(25) [26]=> int(26) [27]=> int(27) [28]=> int(28) [29]=> int(29) [30]=> int(30) [31]=> int(31) [32]=> int(32) [33]=> int(33) [34]=> int(34) [35]=> int(35) [36]=> int(36) [37]=> int(37) [38]=> int(38) [39]=> int(39) [40]=> int(40) [41]=> int(41) [42]=> int(42) [43]=> int(43) [44]=> int(44) [45]=> int(45) [46]=> int(46) [47]=> int(47) [48]=> int(48) [49]=> int(49) [50]=> int(50) [51]=> int(51) [52]=> int(52) [53]=> int(53) [54]=> int(54) [55]=> int(55) [56]=> int(56) [57]=> int(57) [58]=> int(58) [59]=> int(59) } 20array(20) { [0]=> int(40) [1]=> int(41) [2]=> int(42) [3]=> int(43) [4]=> int(44) [5]=> int(45) [6]=> int(46) [7]=> int(47) [8]=> int(48) [9]=> int(49) [10]=> int(50) [11]=> int(51) [12]=> int(52) [13]=> int(53) [14]=> int(54) [15]=> int(55) [16]=> int(56) [17]=> int(57) [18]=> int(58) [19]=> int(59) }