note 83682 deleted from function.call-user-func-array by cmb

From: Date: Sun, 30 Aug 2015 17:58:22 +0000
Subject: note 83682 deleted from function.call-user-func-array by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-203506@lists.php.net to get a copy of this message
Note Submitter: dnhuff at acm.org ---- the order of argument correspondence from the array to the function formal parameters is by 'natural order' of the array and not explicit numerical key order. So: $a[0] = 'arg 1'; $a[2] = 'arg 2'; $a[1] = 'arg 3'; call_user_func_array('foo', $a); delivers the args to foo in the order the keys were inserted! as in... foo($a[0], $a[2], $a[1]); if you wanted something else, ksort the array first.

« previous php.notes (#203506) next »