Which of the following function declarations is correct in PHP?
a) function soma(int $a, int $b){return $a+$b;}
b) function soma($a, $b){return $...
Which of the following function declarations is correct in PHP?
a) function soma(int $a, int $b){return $a+$b;} b) function soma($a, $b){return $a+$b;} c) function soma(int $a, $b){return $a+$b;} d) function soma($a: int, $b: int){return $a+$b;} e) function Integer soma($a: Integer, $b: Integer){return $a+$b;}
A alternativa correta é a letra b) function soma($a, $b){return $a+$b;}.
Essa é a forma mais comum de declarar uma função em PHP, sem especificar o tipo de dados dos parâmetros. As outras alternativas apresentam erros de sintaxe ou tentam especificar o tipo de dados de forma incorreta.
0
0
Faça como milhares de estudantes: teste grátis o Passei Direto
Compartilhar