1

地獄、私はPHPサイトで「使用」のドキュメントを見つけることさえできません(名前空間のコンテキスト以外-キーワードBTWを曖昧にする素晴らしい仕事です)。

function() use ($foo) { }5.3以降でのみ利用可能であることを確認できますか? そして、それはどこで文書化されましたか?

追加のボーナスとして、「use」を使用できないことをどのようにコーディングしますか (例: create_function($args, $funcname) を array_map() のコールバックとして使用)?

4

2 に答える 2

2

Closures are introduced in 5.3, thus use in conjunction with closures are also available in 5.3 or later (of course).

As an added bonus, how would you code around not being able to use 'use' within a closure

I don't understand the question completely, but because both closures and use with closures comes with the same version, there is no situation, where you can not use use with closures. Either both, or nothing (--> <5.3)

http://php.net/functions.anonymous

Release Notes 5.3.0

于 2011-06-14T17:26:10.207 に答える