我有这种格式的数组...
[User] => Array
(
[Oct 09] => Array
(
[10] => 1
[8] => 0
[9] => 0
[7] => 0
[6] => 0
)
[Oct 10] => Array
(
[10] => 0
[8] => 1
[9] => 0
[7] => 0
[6] => 0
)
[Oct 11] => Array
(
[10] => 1
[8] => 0
[9] => 1
[7] => 1
[6] => 1
)
)
我想在不使用任何循环的情况下解析数组,以便它以形式转换
[User]=>array
(
[0] =>array(
[date] => OCt 09
[user_id] => 10
[attendance] => 1
)
[1] =>array(
[date] => OCt 09
[user_id] => 8
[attendance] => 0
)
)
像这样我不想使用 foreach 或 for 循环,因为它需要时间来解析。我想使用内置数组函数。我尝试的是
public function parseAttendance($y){
return array("date", "user_id", "attendane"); // I want to return something like in this format.
}
public function admin_attendance() {
$result = array_map(array($this, 'parseAttendance'), $arr['User']);
print_r($result);
die();
}