sudo apt install php7.4-common php7.4-cli php7.4-bcmath php7.4-bz2 php7.4-curl php7.4-gd php7.4-intl php7.4-json php7.4-mbstring php7.4-readline php7.4-xml php7.4-zip php7.4-fpm
function test(...$args) { var_dump($args); }
test(1, 2, 3);
$arr = [...$args];
array(5) {
[0]=>
string(6) "banana"
[1]=>
string(6) "orange"
[2]=>
string(5) "apple"
[3]=>
string(4) "pear"
[4]=>
string(10) "watermelon"
}
download XAMPP
https://www.apachefriends.org/download.html
pub 4096R/7BD5DCD0 2016-05-07
Key fingerprint = A917 B1EC DA84 AEC2 B568 FED6 F50A BC80 7BD5 DCD0
uid Davey Shafik <davey@php.net>
pub 2048R/31CBD89E 2016-12-08
Key fingerprint = 5289 95BF EDFB A719 1D46 839E F9BA 0ADA 31CB D89E
uid Joe Watkins <krakjoe@php.net>
pub 4096R/70D12172 2017-04-14 [expires: 2024-04-21]
Key fingerprint = 1729 F839 38DA 44E2 7BA0 F4D3 DBDB 3974 70D1 2172
uid Sara Golemon <pollita@php.net>
Parse error: syntax error, unexpected '...' (T_ELLIPSIS), expecting ']' in /app/spread-operator.php on line 3
$parts = ['apple', 'pear'];
$fruits = ['banana', 'orange', ...$parts, 'watermelon'];
var_dump($fruits);