note 108619 added to function.array-reduce

From: Date: Fri, 11 May 2012 08:30:26 +0000
Subject: note 108619 added to function.array-reduce
Groups: php.notes 
Request: Send a blank email to php-notes+get-187928@lists.php.net to get a copy of this message
<?php $n = array_reduce(array(10, 5, 1), function($x, $xs) { return $x - $xs; }, 20); // If right-associative, we should get the equivalent of 20 - (10 - (5 - 1)) = 14 // If left-associative, we should get the equivalent of ((20 - 10) - 5) - 1 = 4 echo $n; // echoes 4, so array_reduce is left-associative ---- Server IP: 91.199.167.223 Probable Submitter: 145.97.196.21 ---- Manual Page -- http://www.php.net/manual/en/function.array-reduce.php Edit -- https://master.php.net/note/edit/108619 Del: integrated -- https://master.php.net/note/delete/108619/integrated Del: useless -- https://master.php.net/note/delete/108619/useless Del: bad code -- https://master.php.net/note/delete/108619/bad+code Del: spam -- https://master.php.net/note/delete/108619/spam Del: non-english -- https://master.php.net/note/delete/108619/non-english Del: in docs -- https://master.php.net/note/delete/108619/in+docs Del: other reasons-- https://master.php.net/note/delete/108619 Reject -- https://master.php.net/note/reject/108619 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#187928) next »