note 28506 deleted from functions.returning-values by cmb

From: Date: Thu, 13 Aug 2020 09:31:41 +0000
Subject: note 28506 deleted from functions.returning-values by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-214952@lists.php.net to get a copy of this message
Note Submitter: ian at NO_SPAM dot verteron dot net ---- In reference to the poster above, an additional (better?) way to return multiple values from a function is to use list(). For example: function fn($a, $b) { # complex stuff return array( $a * $b, $a + $b, ); } list($product, $sum) = fn(3, 4); echo $product; # prints 12 echo $sum; # prints 7

« previous php.notes (#214952) next »