Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's not totally correct. PHP has a "short function" syntax for that specific use case, it automatically captures data without the 'use' statement.

    $a = 5;
    $b = fn ($c) => $a * $b;
    print($b(2)); // 10
    print($b(4)); // 20


This "arrow function" syntax was introduced much later, though.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: