I have the variable that holds numbers...before writing it to database it must be in this format:
["1", "6", "11", "15"]
I got this from my ajax call:
1,6,11,15
I try to convert string with numbers to array...and now one way is to foreach to read from array and add to beginning and ending string " but i think that is bad idea...could be simpler way to archive this above output?
$numbers = '1,6,11,15';
$a = str_split($numbers);
print_r($a);
json. you should usejson_encodewithexplode with commafunction