function()use()のようなPHPクロージャー関数は、匿名関数をサポートしていないので、PHP 5.2版でどのように使用できますか?PHP 5.2のバージョンでfunction()use()のようなPHPクロージャー関数を使用するにはどうしたらいいですか?
現在、私のコードは
$this->init(function() use($taxonomy_name, $plural, $post_type_name, $options)
{
// Override defaults with user provided options
$options = array_merge(
array(
"hierarchical" => false,
"label" => $taxonomy_name,
"singular_label" => $plural,
"show_ui" => true,
"query_var" => true,
"rewrite" => array("slug" => strtolower($taxonomy_name))
), $options
);
// name of taxonomy, associated post type, options
register_taxonomy(strtolower($taxonomy_name), $post_type_name, $options);
});
ツールバーのコードボタン( '{}')を使用してコードをフォーマットしてください。 –
可能な複製[PHP 5.2.xでクロージャをシミュレートすることは可能ですか?グローバルを使用していませんか?](http://stackoverflow.com/questions/2209327/is-it-possible-to-simulate-closures-in-php- 5-2-x-not-use-globals) – ceejayoz