• 11Nov

    In this three-part tutorial, I make up a dynamic story as I go along using a lot of the functions that I have taught about before. If you would like to see another way of applying variables and functions called array, count, date, echo, mktime, and rand: it is highly suggested you take your time and watch this tutorial.
    You need flash to play this tutorial.
    This tutorial goes over the following goals:
    Use Previous functions to make up a story
    Use some random generation to do some
    story randomization that is used later
    Have Fun
    You can find this tutorial video on youtube here.


    Lets Make up a Story! Part 2You need flash to play this tutorial.
    This tutorial goes over the following goals:
    Use Previous functions to make up a story
    Use some random generation to do some
    story randomization that is used later
    Have Fun
    You can find this tutorial video on youtube here.

    Here are the sources used in this tutorial:
    tut020.php
    <?php
    //PHP Tutorial 020
    ?>
    Hello, adventurer, it was a dark and stormy <?php
    $x = rand(1,6);
    
    $save =  mktime(0,0,0,2,$x,1995);
    
    echo date("l",$save);
    ?> night! You are with <?php
    $people =  rand(2,40);
    
    echo $people;
    ?> other people, and you want to go and mow the grand lawn of the ages!<br />
    One of your best friends, <?php
    $friends = array();
    
    $friends[] = "Joe";
    $friends[] = "James";
    
    $friends[] = "John";
    $friends[] = "Jacob";
    
    $friend = $friends[rand(0,count($friends)-1)];
    
    echo $friend;
    ?> wants to join you on your wonderful adventure! Now, you must decide to let him or not!<br />
    <?php
    $yesorno = rand(0,1);
    
    if($yesorno){
    	echo " You said yes to $friend!";
    
    }else{
    	echo " You said no to $friend!";
    }
    ?> Because you said, <?php
    
    if($yesorno){
    	echo "yes";
    }else{
    
    	echo "no";
    }
    ?>, your friend is quite <?php
    if($yesorno){
    
    	echo "happy!";
    }else{
    	echo "sad.";
    }
    
    ?> Now you and <?php
    if($yesorno){
    	echo $people + 1;
    
    }else{
    	echo $people;
    }
    ?> other people traveled over the Neatherlands! 

    Here are all the php functions used in this tutorial:

    Posted by Kloplop321 @ 6:27 pm

One Response

WP_Orange_Techno

Leave a Comment

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