3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = '1, 4, 7, 20-25, 31, 46, 100'; $entries = array_map( 'trim', str_getcsv( $input)); $result = array(); foreach( $entries as $entry) { if( strpos( $entry, '-') !== false) { list( $start, $end) = explode( '-', $entry); $result = array_merge( $result, range( $start, $end)); } else { $result[] = $entry; } } print_r( $result); echo implode( ', ', $result);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => 1 [1] => 4 [2] => 7 [3] => 20 [4] => 21 [5] => 22 [6] => 23 [7] => 24 [8] => 25 [9] => 31 [10] => 46 [11] => 100 ) 1, 4, 7, 20, 21, 22, 23, 24, 25, 31, 46, 100

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:
39.98 ms | 402 KiB | 8 Q