3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dates = [ '2022-10-23' => '2022-10-23', '2022-10-24' => '2022-10-24', '2022-10-25' => '2022-10-25', '2022-10-26' => '2022-10-26', '2022-10-27' => '2022-10-27', '2022-10-28' => '2022-10-28', '2022-10-29' => '2022-10-29' ]; $rows = [ '2022-10-24' => [ 'id' => 11, 'user_id' => 1, 'notitie' => 'Mag al helemaal niet', 'datum' => '2022-10-24', 'user_role' => 'client' ], '2022-10-26' => [ 'id' => 15, 'user_id' => 1, 'notitie' => 26, 'datum' => '2022-10-26', 'user_role' => 'client' ], ]; var_export( array_map( fn($v) => $rows[$v] ?? [], $dates ) );
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
array ( '2022-10-23' => array ( ), '2022-10-24' => array ( 'id' => 11, 'user_id' => 1, 'notitie' => 'Mag al helemaal niet', 'datum' => '2022-10-24', 'user_role' => 'client', ), '2022-10-25' => array ( ), '2022-10-26' => array ( 'id' => 15, 'user_id' => 1, 'notitie' => 26, 'datum' => '2022-10-26', 'user_role' => 'client', ), '2022-10-27' => array ( ), '2022-10-28' => array ( ), '2022-10-29' => array ( ), )

preferences:
87.66 ms | 1349 KiB | 4 Q