Any alternative of end for PHP functions instead } ? Something like
function test():
endfunction;
I saw alternative structures for if, while, switch or foreach, but nothing for functions.
Thank you!
PHP AdvancedPHP Date and Time PHP Include PHP File Handling PHP File Open/Read PHP File Create/Write PHP File Upload PHP Cookies PHP Sessions PHP Filters PHP Filters Advanced PHP Callback Functions PHP JSON PHP Exceptions.
PHP has over 1000 built-in functions that can be called directly from within a script to perform a specific task in PHP Functions.
The endif keyword is used to mark the end of an if conditional which was started with the if(...): syntax. It also applies to any variation of the if conditional, such as if... elseif and if...else .
The fn keyword is used to create arrow functions. Arrow functions are only available in PHP versions 7.4 and up. Arrow functions have access to all variables from the scope in which they were created.
No this is not possible see http://php.net/manual/en/control-structures.alternative-syntax.php
PHP offers an alternative syntax for some of its control structures; namely, if, while, for, foreach, and switch. In each case, the basic form of the alternate syntax is to change the opening brace to a colon (:) and the closing brace to endif;, endwhile;, endfor;, endforeach;, or endswitch;, respectively.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With