Skip to content
Advertisement

PHP return type

Is it possible to define the return type like this?

JavaScript

Advertisement

Answer

As per this page : http://php.net/manual/en/language.types.type-juggling.php

You can try doing,

JavaScript

Now PHP offer return type declaration from PHP 7. I have explained how to use return type in PHP

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement