• 11Nov

    Sometimes it is best to shorten our coding by making our own functions that we can use more than once but only require only one line the second time.
    You need flash to play this tutorial.
    This tutorial goes over the following goals:
    Build a function
    Use a custom function
    You can find this tutorial video on youtube here.

    Here are the sources used in this tutorial:
    tut021.php
    <?php
    //PHP Tutorial 021
    
    function happyturtles($turtles){
    	global $google;
    
    	$turtles = (int)$turtles;
    	$turtles = $turtles*2;
    
    	echo rand(0,200)." ";
    	return $turtles." ";
    
    }
    $google = 1;
    echo happyturtles(30);
    
    echo happyturtles(31);
    echo happyturtles(32);
    echo happyturtles(33);
    
    ?>

    Here are all the php functions used in this tutorial:

    Posted by Kloplop321 @ 6:39 pm

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.