Created
September 21, 2019 22:51
-
-
Save Chemaclass/1a39db3954e0be006b370e8c2bd0e587 to your computer and use it in GitHub Desktop.
Docu - Return type declarations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function arraysSum(array ...$arrays): array | |
| { | |
| return array_map(function(array $array): int { | |
| return array_sum($array); | |
| }, $arrays); | |
| } | |
| print_r(arraysSum([1,2,3], [4,5,6], [7,8,9])); | |
| ?> | |
| // outputs: | |
| Array | |
| ( | |
| [0] => 6 | |
| [1] => 15 | |
| [2] => 24 | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment