PHP: Solution 3


Introduction | Static vs. Dynamic Websites | Using PHP on RCI or Eden | A Simple PHP Program | Practice 1 | Loops | Practice 2 | Functions | Practice 3 | Conditionals | Practice 4 | PHP and Online Forms | Practice 5 | PHP and E-mail | Practice 6 | Conclusion


The solution to practice 3 is:

<html>
<? function spacer($j) {
        for ($i=0; $i < $j; $i++) { 
                echo "<br>";  
        } 
} ?>

I like 
<? spacer(5); ?>
to space
<? spacer(7); ?> 
things 
<? spacer(6); ?>
out
</html>

Now, that you have an idea of how to use functions, you should consider how they can be used to automate the look of your website. Doing so will allow you to maintain multiple websites efficiently.



edseries@nbcs.rutgers.edu