3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'client_no=100&auth_key=stEKy9vvN9mKEPTeAdNkfeuUE5CGHknB&rest_call=create_surcharge&cat=admintools-api&surcharge_name=mysurcharge1&description=description123&ext_description=description1234&currency_cd=usd&surcharge_type_cd=F&inline_offset_ind=I&apply_b4_or_after_discount_cd=B&scope_no=1&surcharge_tier[0][from]=1&surcharge_tier[0][rate]=3&plan_no[0][plan_nos]=asd&schedule[0][schedule_name]=TestSchedule1&schedule[0][currency_cd]=usd&submit=Agree & Execute'; parse_str($string, $output); var_dump($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 : ''); } else if(is_array($val)) { $rowObjectExample .= ($i <= count($val) ? $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)) { $rowObjectExample .= $k.'_row '.$k.'Row'.$row.' = new '.$k.'_row()'."\n\t"; $n++; foreach($column as $r=>$c) { $rowObjectExample .= $k.'Row'; if($len > 1) { $rowObjectExample .= ($n <= $len ? $row : ''); } $rowObjectExample .= '.'.$r.' = '; $rowObjectExample .= (empty($c) ? 'null' : $c)."\n\t"; } } } } else { $rowObjectExample .= $name.'Row'; $rowObjectExample .= ($i <= count($val) ? $key : ''); $rowObjectExample .= '.'.$k.' = '.$v."\n\t"; } } } } } } } var_dump($rowObjectExample);
Output for git.master, git.master_jit, rfc.property-hooks
array(17) { ["client_no"]=> string(3) "100" ["auth_key"]=> string(32) "stEKy9vvN9mKEPTeAdNkfeuUE5CGHknB" ["rest_call"]=> string(16) "create_surcharge" ["cat"]=> string(14) "admintools-api" ["surcharge_name"]=> string(12) "mysurcharge1" ["description"]=> string(14) "description123" ["ext_description"]=> string(15) "description1234" ["currency_cd"]=> string(3) "usd" ["surcharge_type_cd"]=> string(1) "F" ["inline_offset_ind"]=> string(1) "I" ["apply_b4_or_after_discount_cd"]=> string(1) "B" ["scope_no"]=> string(1) "1" ["surcharge_tier"]=> array(1) { [0]=> array(2) { ["from"]=> string(1) "1" ["rate"]=> string(1) "3" } } ["plan_no"]=> array(1) { [0]=> array(1) { ["plan_nos"]=> string(3) "asd" } } ["schedule"]=> array(1) { [0]=> array(2) { ["schedule_name"]=> string(13) "TestSchedule1" ["currency_cd"]=> string(3) "usd" } } ["submit"]=> string(6) "Agree " ["Execute"]=> string(0) "" } string(324) "surcharge_tier_row surcharge_tierRow0 = new surcharge_tier_row(); surcharge_tierRow0.from = 1 surcharge_tierRow0.rate = 3 plan_no_row plan_noRow0 = new plan_no_row(); plan_noRow0.plan_nos = asd schedule_row scheduleRow0 = new schedule_row(); scheduleRow0.schedule_name = TestSchedule1 scheduleRow0.currency_cd = usd "

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:
55.8 ms | 404 KiB | 8 Q