3v4l.org

run code in 300+ PHP versions simultaneously
<?php $option_array[] = [ 'Condition' => [ 'nm' => 'Near Mint/Mint', 'sp' => 'Slightly Played', 'hp' => 'Heavily PLayed' ], 'Style' => [ 'normal' => 'Normal', 'foil' => 'Foil' ] ]; $N = 1; foreach ($option_array as $options) $N *= count($options); $all_combinations = array(); for( $i = 0 ; $i < $N ; ++$i ) { $all_combinations[$i] = array(); $q = $i; for( $j = count($option_array)-1 ; 0 <= $j ; --$j ) { $opt = $option_array[$j]; $nopts = count($opt['options']); $all_combinations[$i][$opt['name']] = $opt['options'][$q % $nopts]; $q = floor($q / $nopts); } } print_r( $all_combinations );
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key "options" in /in/subUv on line 26 Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /in/subUv:26 Stack trace: #0 {main} thrown in /in/subUv on line 26
Process exited with code 255.

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:
53.74 ms | 401 KiB | 8 Q