php function hello name return Hello name function goodbye name return

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
function hello($name)
{
return “Hello $name!\n”;
}
function goodbye($name)
{
return “Goodbye $name!\n”;
}
function age($birthday)
{
$ts = strtotime($birthday);
if($ts === -1) {
return “Unknown”;
} else {
$diff = time() - $ts;
return floor($diff/(24*60*60*365));
}
}
$name = “george”;
$bday = “10 Oct 1973;
echo hello($name);
echo “You are .age($bday). years old.\n”;
echo goodbye($name);
?>