Doc #75546 [Ver]: Clarification for how iterator_apply's $args are passed to the $function

From: Date: Wed, 22 Nov 2017 06:31:29 +0000
Subject: Doc #75546 [Ver]: Clarification for how iterator_apply's $args are passed to the $function
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15250@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75546&edit=1 ID: 75546 User updated by: ycgambo at outlook dot com Reported by: ycgambo at outlook dot com Summary: Clarification for how iterator_apply's $args are passed to the $function Status: Verified Type: Documentation Problem Package: SPL related Operating System: centos6 PHP Version: 5.6.32 Block user comment: N Private report: N New Comment: Got it, thanks for reply. Previous Comments: ------------------------------------------------------------------------ [2017-11-21 07:17:12] requinix@php.net $args is an array and each of its elements are passed to the callback as separate arguments. https://3v4l.org/6Qrnk ------------------------------------------------------------------------ [2017-11-21 06:21:38] ycgambo at outlook dot com Description: ------------ --- From manual page: http://www.php.net/function.iterator-apply --- the 3rd parameter args of iterator-apply doesn't passed to callback as an array. Test script: --------------- <?php $ai = new ArrayIterator(range(0, 2)); iterator_apply($ai, function($args) { var_dump($args); return true; }, array(1, 2)); Expected result: ---------------- array(2) { [0] => int(1) [1] => int(2) } array(2) { [0] => int(1) [1] => int(2) } array(2) { [0] => int(1) [1] => int(2) } Actual result: -------------- int(1) int(1) int(1) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75546&edit=1

« previous php.doc.bugs (#15250) next »