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);

preferences:
38.35 ms | 402 KiB | 5 Q