3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '[{"type":"date","label":"Champ Date de ","className":"form-control","name":"date-1545929424866"},{"type":"checkbox-group","label":"You like it ? ","name":"checkbox-group-1545929428281","values":[{"label":"Option 1","value":"1","selected":true}]}]'; $array = json_decode($json,1); $expected = []; foreach($array as $k=>$v){ foreach($v as $key=>$value){ if($key == 'label' && !is_array($value)){ $expected[$k][$key]= trim($value); }else{ $expected[$k][$key]= $value; } } } echo json_encode($expected); ?>
Output for git.master, git.master_jit, rfc.property-hooks
[{"type":"date","label":"Champ Date de","className":"form-control","name":"date-1545929424866"},{"type":"checkbox-group","label":"You like it ?","name":"checkbox-group-1545929428281","values":[{"label":"Option 1","value":"1","selected":true}]}]

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:
143.99 ms | 406 KiB | 5 Q