?? operator php 7 code example
Example 1: php null coalesce
// if $_POST['name'] doesn't exist $result will equal to John
$result = $_POST['name'] ?? 'John';
Example 2: php 7
<?php
function arraysSum(array ...$arrays): array
{
return array_map(function(array $array): int {
return array_sum($array);
}, $arrays);
}
print_r(arraysSum([1,2,3], [4,5,6], [7,8,9]));