Authenticate¶
Functions declared with void as their return type must either omit their return statement altogether, or use an empty return statement. null is not a valid return value for a void function.
Void function may throw exceptions or return without a parameter.
Null and void are two different notions.
<?php
function foo(&$a) : void {
$a++;
// No return used here
}
$b = 0;
foo($b);
?>
Related : Null
Added in PHP 8.0