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

Prior to PHP 5.3 this could work as well:

    array_reduce(array(1,2,3,4,5), create_function('$v, $e', 'return $v | $e;'), 0);


I'm really glad that 5.3 got proper anonymous functions. Specifying function bodies as strings to be eval'd makes me twitch.




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

Search: