3v4l.org

run code in 300+ PHP versions simultaneously
<?php $names = [ "Ayush" , "Vaibhav", "Shivam", "Hacker", "Topper", "ABCD", "NameR", "Tammi", "Colgate", "Britney"//, "Bra"//, "Kisser" ]; $addthis = 'ADDTHIS'; $every = 3; $result = array(); $cnt = 0; foreach ($names AS $val) { $result[] = $val; if ($cnt >=3) { $result[] = $addthis; $cnt = 0; } $cnt++; } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => 'Ayush', 1 => 'Vaibhav', 2 => 'Shivam', 3 => 'Hacker', 4 => 'ADDTHIS', 5 => 'Topper', 6 => 'ABCD', 7 => 'NameR', 8 => 'ADDTHIS', 9 => 'Tammi', 10 => 'Colgate', 11 => 'Britney', 12 => 'ADDTHIS', )

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:
31.22 ms | 406 KiB | 5 Q