note 128036 added to function.array-sum

From: Date: Wed, 21 Dec 2022 11:19:18 +0000
Subject: note 128036 added to function.array-sum
Groups: php.notes 
Request: Send a blank email to php-notes+get-219993@lists.php.net to get a copy of this message
Notably the function converts strings to float and ignores strings if they are not convertable: <?php $a = array("String", 2, 4, 6, 8); echo "sum(a) = " . array_sum($a) . "\n"; $b = array("12.3456", 2, 4, 6, 8); echo "sum(b) = " . array_sum($b) . "\n"; ?> sum(a) = 20 sum(b) = 32.3456 ---- Server IP: 45.112.84.4 Probable Submitter: 185.85.3.175 (proxied: 178.200.132.26) ---- Manual Page -- https://php.net/manual/en/function.array-sum.php Edit -- https://main.php.net/note/edit/128036 Del: integrated -- https://main.php.net/note/delete/128036/integrated Del: useless -- https://main.php.net/note/delete/128036/useless Del: bad code -- https://main.php.net/note/delete/128036/bad+code Del: spam -- https://main.php.net/note/delete/128036/spam Del: non-english -- https://main.php.net/note/delete/128036/non-english Del: in docs -- https://main.php.net/note/delete/128036/in+docs Del: other reasons-- https://main.php.net/note/delete/128036 Reject -- https://main.php.net/note/reject/128036 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#219993) next »