ajout fonction
This commit is contained in:
parent
0697f1d98a
commit
6cf9146979
22
functions.php
Normal file
22
functions.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
echo formatage_bonjour("NIHART", "jérémi", 19); # dois retourner "Bonjour Nihart Jérémi j'ai 19 ans"
|
||||
echo formatage_bonjour("FlORquin", "cOraLie", 20); # dois retourner "Bonjour Florquin Coralie j'ai 19 ans"
|
||||
|
||||
|
||||
function formatage_bonjour(string $nom, string $prenom, int $age) : string
|
||||
{
|
||||
return "Bonjour " . ucfirst(strtolower($nom)) . " " . ucfirst(strtolower($prenom)) . " tu as $age ans <br>";
|
||||
}
|
||||
|
||||
|
||||
function verification_age(int $age) : string
|
||||
{
|
||||
if ($age >= 18) {
|
||||
return "majeur";
|
||||
} else {
|
||||
return "mineur";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user