How and When to use Arrow functions in PHP

Опубликовано: 26 Май 2021
на канале: Rehan Manzoor
228
6

#phparrowfunctions #rehanmanzoor
Whatsup guys!

In this video, I want to show you what are arrow functions, it's history and how to use arrow functions.

00:00 Introduction and History of PHP arrow functions
01:05 arrow functions in other languages such as javascript, c#, python
01:30 Practical examples of PHP closures vs PHP arrow functions

If you like this video, be sure to like, share and subscribe 👍.

🤠You can find me on twitter   / therummykhan  

Arrow functions
Arrow functions were introduced in PHP 7.4 as a more concise syntax for anonymous functions.
Both anonymous functions and arrow functions are implemented using the Closure class.
Arrow functions support the same features as anonymous functions, except that using variables from the parent scope is always automatic.

When a variable used in the expression is defined in the parent scope it will be implicitly captured by-value. In the following example, the functions $fn1 and $fn2 behave the same way.

References:
Arrow functions RFC: https://wiki.php.net/rfc/arrow_functi...
PHP Manual: https://www.php.net/manual/en/functio...


Смотрите видео How and When to use Arrow functions in PHP онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Rehan Manzoor 26 Май 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 22 раз и оно понравилось людям.