Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
$m = [1 => 20, 30 => 40, 98 => 99];
$m1 = [1 => 5, 37 => 42, 80 => 99];
$keys = array_keys($m);
$keys1 = array_keys($m1);
$values = array_values($m);
$values1 = array_values($m1);
$n = count($keys);
$n1 = count($keys1);
for($i=0; $i<max($n, $n1); $i++){
$res[min($keys[$i], $keys1[$i])] = max($values[$i], $values1[$i]);
}
print_r ($res);