Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

function passing multiple arguments using 3 dots php

function concatenate($transform, ...$strings) {
    $string = '';
    foreach($strings as $piece) {
        $string .= $piece;
    }
    return($transform($string));
}

echo concatenate("strtoupper", "I'd ", "like ", 4 + 2, " apples");
// This would print:
// I'D LIKE 6 APPLES
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #function #passing #multiple #arguments #dots #php
ADD COMMENT
Topic
Name
4+4 =