PHP Snippet 1:
$array_module_rate = array(
'5',
'3',
'4'
}
$global_course = 5;
foreach($array_module_rate as $key=>$value){
$array_module_rate[$key]=$global_course* $value;
}
PHP Snippet 2:
$array_module_rate = array(
'5',
'3',
'4'
);
$global_course = 5;
array_map(function($cal) use($global_course) {
return $cal * $global_course;
}, $array_module_rate);
PHP Snippet 3:
array_walk($array_module_rate, function(&$cal) use ($global_course) {
$cal *= $global_course;
});
PHP Snippet 4:
var_export(
array_map(fn($v) => $v * $global_course, $array_module_rate)
);
PHP Snippet 5:
array (
0 => 25,
1 => 15,
2 => 20,
)