i have a string like this :
JavaScript
x
$string = 'LatLng(35.700585, 51.377027)';
how i can select first section between ‘(‘ and ‘,’ character?
Like :
JavaScript
$x = '35.700585';
$y = '51.377027';
help . thanks
Advertisement
Answer
I think this is what you want:
JavaScript
<?php
$string = 'LatLng(35.700585, 51.377027)';
$newStr = str_replace('LatLng(', '', $string);
$newStr = str_replace(')', '', $newStr);
$arr = explode(',', $newStr);
$x = $arr[0];
$y = $arr[1];
print_r($y);