3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr='[{"sku":"Pizza001","position":0,"category_id":"67"},{"sku":"Birthday Cake","position":0,"category_id":"67"},{"sku":"Birthday Cake-1","position":0,"category_id":"67"},{"sku":"Fruit cake","position":0,"category_id":"67"},{"sku":"Birthday Cake for Gift","position":0,"category_id":"67"}]'; $raw_data = json_decode($arr, true); echo "Page 1\n"; paginate($raw_data,1); echo "Page 2\n"; paginate($raw_data,2); echo "Page 3\n"; paginate($raw_data,3); function paginate($data, $page = 2, $perPage = 2) { $x = ($page - 1) * $perPage; $z = $page * $perPage; $y = ($z > count($data)) ? count($data) : $z; for(; $x < $y; $x++) { print_r($data[$x]); } }
Output for git.master, git.master_jit, rfc.property-hooks
Page 1 Array ( [sku] => Pizza001 [position] => 0 [category_id] => 67 ) Array ( [sku] => Birthday Cake [position] => 0 [category_id] => 67 ) Page 2 Array ( [sku] => Birthday Cake-1 [position] => 0 [category_id] => 67 ) Array ( [sku] => Fruit cake [position] => 0 [category_id] => 67 ) Page 3 Array ( [sku] => Birthday Cake for Gift [position] => 0 [category_id] => 67 )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
47.03 ms | 2108 KiB | 4 Q