Leave a Reply

2 Comments on "What’s new in PHP 7.1: Void types (6/12)"

Notify of
avatar

Tijs de Vries
Guest
Tijs de Vries
10 days 17 hours ago

In other languages I would just use 'return;' to break out of the function if necessary. How does PHP 7.1 go about that? Can you still do that, since you're not returning anything with it?

Manolis Agkopian
Guest
Manolis Agkopian
10 days 17 hours ago

It's the same with PHP, this is just about declaring that this particular method must not return anything back. So, in case you accidentally try to return something, the interpreter will give you an error so you will know that you made a mistake.

wpDiscuz