Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternative of PHP functions structure

Tags:

function

php

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!

like image 897
Adrian Avatar asked Jul 13 '17 13:07

Adrian


People also ask

What are different PHP functions?

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.

How many PHP functions are there?

PHP has over 1000 built-in functions that can be called directly from within a script to perform a specific task in PHP Functions.

What is endif PHP?

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 .

What is FN in PHP?

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.


1 Answers

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.

like image 170
Niels Avatar answered Oct 20 '22 09:10

Niels