3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array['route'] = 'LINESTRING(-25.3233034167988 -57.640113830566406,-25.3229348965009 -57.64023184776306,-25.322653656571582 -57.63954520225525,-25.323410093517822 -57.63928771018982,-25.3229058027454 -57.6378607749939,-25.322973688164012 -57.63678789138794,-25.323371301994506 -57.63360142707825,-25.322003892857673 -57.633676528930664,-25.31995759927745 -57.633376121520996,-25.319336915717006 -57.63331174850464,-25.317988857651912 -57.63302206993103,-25.317377862364236 -57.63294696807861,-25.317688209562228 -57.62954592704773)'; $str = $array['route']; // Get the string from the array $str = substr( $str, 11); // Get rid of "LINESTRING(" $str = substr( $str, 0, strlen( $str) -1); // Get rid of trailing ")" $objective = str_getcsv( $str); // Form the objective array. foreach( $objective as $k => $v) { list( $x, $y) = explode( ' ', $v); $objective[$k] = array(); $objective[$k]['x'] = $x; $objective[$k]['y'] = $y; } print_r( $objective);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [x] => -25.3233034167988 [y] => -57.640113830566406 ) [1] => Array ( [x] => -25.3229348965009 [y] => -57.64023184776306 ) [2] => Array ( [x] => -25.322653656571582 [y] => -57.63954520225525 ) [3] => Array ( [x] => -25.323410093517822 [y] => -57.63928771018982 ) [4] => Array ( [x] => -25.3229058027454 [y] => -57.6378607749939 ) [5] => Array ( [x] => -25.322973688164012 [y] => -57.63678789138794 ) [6] => Array ( [x] => -25.323371301994506 [y] => -57.63360142707825 ) [7] => Array ( [x] => -25.322003892857673 [y] => -57.633676528930664 ) [8] => Array ( [x] => -25.31995759927745 [y] => -57.633376121520996 ) [9] => Array ( [x] => -25.319336915717006 [y] => -57.63331174850464 ) [10] => Array ( [x] => -25.317988857651912 [y] => -57.63302206993103 ) [11] => Array ( [x] => -25.317377862364236 [y] => -57.63294696807861 ) [12] => Array ( [x] => -25.317688209562228 [y] => -57.62954592704773 ) )

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