我有一个问题,我想放一个随机数组,其中随机计数一个数组中有多少个数组。我想像下面这样。
// 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,
{{1 }}等
我想要的输出是这样的
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"
}
]
必须是foreach,但我认为我无法在数组内完成