Home >Backend Development >PHP Tutorial >php anonymous function example 1 (use)

php anonymous function example 1 (use)

WBOY
WBOYOriginal
2016-08-08 09:18:55993browse

<span><span></span></span>

<?php
$data = array(&#39;first&#39; => 1, 'second' => 2, 'third' => 3);
$data = array_filter($data, function ($item) use (&$data) {
    echo "Filtering key ", key($data), '<br>', PHP_EOL;
    next($data);
    return false;
});
?>

Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.

The above introduces the PHP anonymous function example 1 (use), including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:error: mcrypthNext article:error: mcrypth