Last active
March 23, 2018 11:15
-
-
Save lloc/239490f2275a2dbc2ee8eef982639867 to your computer and use it in GitHub Desktop.
This file contains 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 variadic_sum( int ... $args ) { | |
return array_sum( $args ); | |
} | |
// echoes 6 | |
echo variadic_sum( 1, 2, 3 ), PHP_EOL; | |
$a = [ 1, 2, 3 ]; | |
$b = [ 4, 5 ]; | |
array_push( $a, ... $b ); | |
// $a contains now [ 1, 2, 3, 4, 5 ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment