items: array:2 [▼
0 => "90"
1 => "600"
]
for ($i = 0; $i <count($this->values); $i++) {
$values[$i]=$this->values[$i];
return [
//$videohistory->user_id,
//emoji_decode($videohistory->publisher->nick_name),
date("Y-m-d H:i:s", $videohistory->create_time),
date("Y-m-d H:i:s", $videohistory->end_time),
diff_date_format($videohistory->begin_time, $videohistory->end_time, "%H sa %i dk. %s sn"),
$values[$i],
];
}
public function map($videohistory): array{
$ret = [];
for ($i = 0; $i <count($this->values); $i++) {
$values[$i]=$this->values[$i];
$ret[] =
[
//$videohistory->user_id,
//emoji_decode($videohistory->publisher->nick_name),
date("Y-m-d H:i:s", $videohistory->create_time),
date("Y-m-d H:i:s", $videohistory->end_time),
diff_date_format($videohistory->begin_time, $videohistory->end_time, "%H sa %i dk. %s sn"),
$values[$i],
];
}
return $ret;
}
$myResult = array_map(function ($myArr1Value, $myArr2Value) {
return 'Any value here';
}, $myArr1, $myArr2);
// output:
// ['Any value here', 'Any value here'];
$items = ["90", "600"];
$myResult = array_map(function ($iterationValue) {
return [
//$videohistory->user_id,
//emoji_decode($videohistory->publisher->nick_name),
date("Y-m-d H:i:s", $videohistory->create_time),
date("Y-m-d H:i:s", $videohistory->end_time),
diff_date_format($videohistory->begin_time, $videohistory->end_time, "%H sa %i dk. %s sn"),
$iterationValue
];
}, $items);
print_r($myResult);
//output:
//[ ['date', 'date', "90"], ['date', 'date', "600"] ];