This is the array given
$arr = array(',12,10',',9,10');
I want to remove the first blank element from the starting and the new array should be
$arr = array('12,10','9,10');
This is the array given
$arr = array(',12,10',',9,10');
I want to remove the first blank element from the starting and the new array should be
$arr = array('12,10','9,10');
You can do it with trim or rtrim
array_map(function ($s) { return ltrim($s, ','); }, $arr);
Or
array_map(function ($s) { return trim($s, ','); }, $arr);
Output:- https://eval.in/941395
Note:- trim()
will remove leading and trailing extra comma from each array element