3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = '{ "plumber1": "-1.2523238641713191,36.87899683074249", "plumber2": "-1.2192245641713191,36.87899687428849", "allan plumber": "-1.2192238641713191,36.87899683068849" }'; $array =json_decode($str); $new_array = []; foreach ($array as $key => $value) { $coordinates = explode(',',$value); $coordinate1 = (float) $coordinates[0]; $coordinate2 = (float) $coordinates[1]; $new_array[] = array($key,$coordinate1,$coordinate2); } print_r($new_array); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [0] => plumber1 [1] => -1.2523238641713 [2] => 36.878996830742 ) [1] => Array ( [0] => plumber2 [1] => -1.2192245641713 [2] => 36.878996874288 ) [2] => Array ( [0] => allan plumber [1] => -1.2192238641713 [2] => 36.878996830688 ) )

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:
42.47 ms | 1734 KiB | 4 Q