Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Void

Void is a return type. It marks methods which do not return anything.

Indeed, void methods should not use the return statement, or, when they do, use it without any argument.

Void is only possible with methods, closures, functions and arrow functions. It makes no sense with properties or parameters.

<?php

function foo() : void {}

?>

Documentation

See Also