3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ "1,2,3,4", "1,2,3", "1,2" ]; $minElements = 3; $defElements = array_fill(0, $minElements, null); foreach ($strings as $string) { [$a, $b, $c] = array_replace($defElements, explode(',', $string, $minElements)); var_export($a); echo ' _ '; var_export($b); echo ' _ '; var_export($c); echo "\n-----------------\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
'1' _ '2' _ '3,4' ----------------- '1' _ '2' _ '3' ----------------- '1' _ '2' _ NULL -----------------

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:
135.45 ms | 405 KiB | 5 Q