Sunday, 11 August 2019

How to use arrow functions in php

I got to know about arrow functions PHP 7.4. I tried using them like

<?php
$num = 1;
$arrowfunction = () => {
 return $num + 1;
}

Because I saw the => operator in the pull request. Just like javascript but this didn't work! I got

Parse error: syntax error, unexpected ')' in /test.php on line 3



from How to use arrow functions in php

No comments:

Post a Comment