3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '&client_sku=item1&service[0][name]=Relay&service[0][service_type]=RS&service[0][tier][0][from]=1&service[0][tier][0][to]=10&service[0][tier][1][from]=11'; parse_str($string, $output); $rowObjectExample = ''; foreach($output as $name => $value) { if(isset($output[$name])) { if(is_array($value)) { $i = 0; $length = count($value); foreach($value as $key=>$val) { $i++; $rowObjectExample .= $name.'_row '.$name.'Row'; if($length > 1) { $rowObjectExample .= ($i <= $length ? $key : ''); } $rowObjectExample .= ' = new '.$name.'_row()'.";\n\t"; if(is_array($val)) { foreach($val as $k=>$v) { if(is_array($v)) { $n = 0; $len = count($v); foreach ($v as $row=>$column) { if(is_array($column)) { foreach($column as $r=>$c) { $rowObjectExample .= $k.'_row '.$k.'Row'; $n++; if($len > 1) { $rowObjectExample .= ($n <= $len ? $row : ''); } $rowObjectExample .= '.'.$r.' = '.$c."\n\t"; } } } } else { $rowObjectExample .= $name.'Row'; if($length > 1) { $rowObjectExample .= ($i <= $length ? $key : ''); } $rowObjectExample .= '.'.$k.' = '.$v."\n\t"; } } } } } } } var_dump($rowObjectExample);
Output for git.master, git.master_jit, rfc.property-hooks
string(183) "service_row serviceRow = new service_row(); serviceRow.name = Relay serviceRow.service_type = RS tier_row tierRow0.from = 1 tier_row tierRow0.to = 10 tier_row tierRow.from = 11 "

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