Remove first and last char from string
Some other possibilities:
Using substr:
$dataList = substr($dataList, 1, -1);
You can also choose to not remove the * from the string but rather remove the empty array values which will always be the first and last element.Using array functions array_pop() and array_shift():
$arrData = array_pop(array_shift($arrData));