create_functionで匿名関数の作成。

PHPマニュアルに載っているだけで、かなり充実しています。
array_warkなどでよく使います。

[php]
array_walk($a, create_function('&$v,$k', '$v = "+" . $v;'));
print_r($a);
?>
[/php]

ただ要素の前に+を付けているだけですが。
匿名関数の使い方の例ということで。

関連する記事:

Powered by

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">