Good afternoon, I currently have the following
["id"]=> array(1) {
[0]=> string(3) "6,1"
}
I don't know what type of array it is and I want to obtain its keys to store and iterate in a for loop, how do I separate that string so that it stays like this
["id"]=> array(1) {
[0]=> string(1) "6"
[1]=> string(1) "1"
}
try doing the following
$data['id'] = explode(',',$data['id'] );
With the little information you have, I will assume two cases, the first where your $id variable only contains one record and the other where you have an array of arrays.
Case one:
You obtain the requested data in the following way:
var_dump obtained:
Case 2 (Array of Arrays):
You obtain the requested data in the following way:
var_dump obtained:
If otherwise and as an extra, what you want is to get all the data separated by commas in a single simple array, you can get it in the following way:
var_dump obtained: