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

From: Date: Tue, 21 Nov 2017 07:17:14 +0000
Subject: Doc #75546 [Opn->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-15249@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 Updated by: requinix@php.net Reported by: ycgambo at outlook dot com -Summary: iterator-apply parameter passed unexpected +Summary: Clarification for how iterator_apply's $args are passed to the $function -Status: Open +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: $args is an array and each of its elements are passed to the callback as separate arguments. https://3v4l.org/6Qrnk Previous Comments: ------------------------------------------------------------------------ [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 (#15249) next »