Functions
Another way that programming optimizes is to give names to common routines that it has to perform. These are called functions, and they are more than variables, because they often act on information, as in this example.
<!DOCTYPE html> <?php function myGreeting($Name){ echo "Hello there ". $Name . "!
"; } myGreeting("Jane Doe"); myGreeting("John Doe"); myGreeting("Barbie"); myGreeting("Ken"); myGreeting("America"); echo "How Are You?"; ?>
The computer runs down the page just as in HTML. When it gets to myGreeting, it takes the value in the parentheses and passes it to the variable "$name." The function then operates on that variable, in this case concatenating "hello there " with the name, an exclamation mark and a line-break element. These three things are concatenated, or brought together, by the period. The entire result is then printed, and the computer goes to the next line and repeats the entire procedure over again, till the end, where it prints "How are You?"