Hacker News new | past | comments | ask | show | jobs | submit login

PHP is terrible, but the following now is valid PHP:

  $addOne = function($a){ return $a + 1 };
  $result = array_map($addOne, array(1,2,3)); // now [2,3,4]
Or:

  // Reference to intval() function.
  $result = array_map(intval, array('1','2','a'));



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

Search: