PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
/* #Запрос который отправляю [{ "user_tg_id": "{{this_user.platform_id}}", "user_points": "{{all_point}}" }] */
Copy Clear
Copy Format Clear
<?php $ar1 = [ 0 => '2021-08-05', 7 => '2021-08-04', 13 => '2021-07-15', 26 => '2021-07-10' ]; $ar2 = [ 0 => ['2021-08-05' => 3], 1 => ['2021-07-10' => 6] ]; $dates = array_reduce( $ar2, function($res, $el) { $res[array_key_last($el)]=array_pop($el); return $res; }, [] ); print_r($dates); $res = array_map( function($el) use($dates){ return $dates[$el] ?? 0; }, $ar1 ); print_r($res);
Show:  
Copy Clear