-
-
Save prondubuisi/1bd387751a8b356fa3ed01bfdafaad82 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Program to concatenate string of user input | |
$firstName = readline("Enter your first name "); | |
$lastName = readline("Enter your last name "); | |
$age = getAge(); | |
$currentYear = date('Y'); | |
$birthYear = $currentYear - (int) $age; | |
echo "Welcome, " . $firstName . " " . " " . $lastName . " (" . $birthYear . ")"; | |
function getAge() { | |
do { | |
$age = readline("Enter your age "); | |
} while(!is_numeric($age)); | |
return $age; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment