PHP Basics In Pictures
Create a user function

What is a user function?

A user function is block of reusable code that you create within your program.

Instructions within the user function can be called or executed from the main program more then once. This makes redundant tasks simpler.

  1. Create a new script with this code:

    <html>
    <head>
    <title>Create a User Function</title>

    <?php
    function myFunction($company) {
    print("<p>Welcome to $company</p>");
    }
    ?>

    </head>

    <body>

    <h3>Start</h3>

    <?php
    $company = "Acme Auto";
    myFunction($company);
    ?>

    <h3>End</h3>

    </body>
    </html>