⊗ppSpFnAnF 2 of 83 menu

Anonymous Functions in PHP

Anonymous are functions that do not have a name. Such functions can be written as variable values.

Let's see how this is done. Let's create an anonymous function and assign it to the variable $func:

<?php $func = function() { return '!!!'; }; ?>

Let's now call our function. To do this, write the variable name and put parentheses after it:

<?php echo $func(); ?>

Make an anonymous function, that will take two numbers as parameters, and return their sum.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline