У меня проблема с тем, что я хочу поместить случайный массив со случайным количеством его количества в массиве.Я хочу сделать это следующим образом.
// Array don't have exact count of how many data is there
$array = array(1,2,3,4,.....)
$data['data'][] = array(
$id,
$date_file,
$emp_id,
$name,
$from_to,
$reason,
$status,
);
Я хочу поместить $array
в $data.
Но это не должен быть вложенный массив, я хочу, чтобы он был в том же полекак id, date_file,
emp_id,
и т. д.
Вывод, который я хочу получить, такой:
array:1 [▼
0 => {#401 ▼
+"id": 1
+"date_file": "2019-07-03 00:00:00"
+"emp_id": 1
+"name": aysan
+"from_to": "2019-07-03 00:00:00"
+"1": 1 //where I want to put the other array start here
+"2": 2 //The number of array is random or different from the others I want to put
+"reason": none
+"Status": "For Approval"
}
]
$array
должен быть foreach, но я не думаю, что смогу сделатьчто внутри массива