有返回值

函数

<?php

function getSum(int $n1, int $n2): int {
    return $n1 + $n2;
}

$sum = getSum(5, 3);
//sum is 8

echo "sum = $sum";