3v4l.org

run code in 300+ PHP versions simultaneously
<?php$input = 'coilovers[strut_and_individual_components][complete_strut][][achse]'); $output = array(); $pointer = $output;while( ($index = strpos( $input, '[')) !== false) { if( $index != 0) { $key = substr( $input, 0, $index); $pointer[$key] = array(); $pointer = $pointer[$key]; } $end_index = strpos( $input, ']'); $array_key = substr( $input, $index, $end_index); $pointer[$array_key] = array(); $pointer = $pointer[$array_key]; $input = substr( $input, $end_index); echo "$input\n";} <?php
Output for git.master, git.master_jit, rfc.property-hooks
<?php$input = 'coilovers[strut_and_individual_components][complete_strut][][achse]'); $output = array(); $pointer = $output;while( ($index = strpos( $input, '[')) !== false) { if( $index != 0) { $key = substr( $input, 0, $index); $pointer[$key] = array(); $pointer = $pointer[$key]; } $end_index = strpos( $input, ']'); $array_key = substr( $input, $index, $end_index); $pointer[$array_key] = array(); $pointer = $pointer[$array_key]; $input = substr( $input, $end_index); echo "$input\n";}

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