doushengyou2617
2010-02-12 03:36
浏览 65
已采纳

如何在PHP5.3中使用匿名函数

I recently really wanted to us anonymous functions in PHP. Unfortunately my host is still on 5.2. I automatically thought this would work:

uasort($array, function($a, $b) {
    return $a > $b;
});

Is this how they work? Simply passed in as an argument instead of a callback? The docs don't say specifically that's how they do, but I have a working knowledge of JavaScript's anonymous functions, so I assumed they would.

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题