It's high time we did something fun. We're going to write a function that determines a person's Star Wars name.
ASP
function starwarsname(firstName, lastName, maidenName, city)
starwarsname = Left(firstName, 3) & LCase(Left(lastName, 2)) & " " & Left(maidenName, 2) & LCase(Left(city, 3))
end function
PHP
function starwarsname($firstName, $lastName, $maidenName, $city)
{
return substr($firstName, 0, 3) . strtolower(substr($lastName, 0, 2)) . " " . substr($maidenName, 0, 2) . strtolower(substr($city, 0, 3));
}
No comments:
Post a Comment