note 103093 added to function.array-sum

From: Date: Fri, 25 Mar 2011 09:27:53 +0000
Subject: note 103093 added to function.array-sum
Groups: php.notes 
Request: Send a blank email to php-notes+get-178194@lists.php.net to get a copy of this message
function sum($arg1 = null, $arg2 = null, $argN = null) { $result = 0; foreach(func_get_args() as $arg) $result += is_array($arg) || $arg instanceof ArrayObject ? call_user_func_array(__FUNCTION__, (array) $arg) : $arg; return $result; } echo sum(1, 2, 3, array(4, 5, 6, array(7, 8, new ArrayObject(array(1, 2, 3))))), "\n"; // Result - 42 ---- Server IP: 195.54.192.44 Probable Submitter: 127.0.0.1 ---- Manual Page -- http://www.php.net/manual/en/function.array-sum.php Edit -- https://master.php.net/note/edit/103093 Del: integrated -- https://master.php.net/note/delete/103093/integrated Del: useless -- https://master.php.net/note/delete/103093/useless Del: bad code -- https://master.php.net/note/delete/103093/bad+code Del: spam -- https://master.php.net/note/delete/103093/spam Del: non-english -- https://master.php.net/note/delete/103093/non-english Del: in docs -- https://master.php.net/note/delete/103093/in+docs Del: other reasons-- https://master.php.net/note/delete/103093 Reject -- https://master.php.net/note/reject/103093 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#178194) next »