Simple Php Tutorial.

Discussion in 'Guides' started by Annex, Feb 25, 2007.

Simple Php Tutorial.
  1. Unread #1 - Feb 25, 2007 at 4:21 PM
  2. Annex
    Joined:
    Aug 28, 2005
    Posts:
    2,324
    Referrals:
    3
    Sythe Gold:
    0
    UWotM8?

    Annex Ballin'
    Veteran (Ex-Admin)
    PHP Programmers Retired Administrator

    Simple Php Tutorial.

    To start off the tutorial you must have a web host or your own server with php enabled. This will host all your php files so you can see if they are working correctly.

    STARTING THE PHP CODE

    We will start off from the beginning. Php stands for "Hypertext Preprocessor". This means it processes the text before HTML makes it look nice. The Php code can be embedded in an HTML page. To do that you must save the page(s) in a .php extension. Using the code
    Code:
    <?php
    at the opening of the php code and
    Code:
    ?>
    at the end of the php code it tells the server that to parse that part of the code using php.

    ECHO FUNCTION

    There are many functions that you can use in php. I'm going to introduce you to a basic one called "echo". Echo displays the text you tell it to. If you were to put
    Code:
    echo "hello world!";
    in your php code then it would say "hello world!" on the page. If you want your page to only say that then you would put this as your code
    Code:
    <?php
    echo "hello world!";
    ?>
    You must remember to put the semicolon after each echo because it tells the php parser to end the line. If you don't end the line after a function it will draw an error that will say something like "; expected on line <linenumber>". To echo a variable you would put
    Code:
    echo $variable;
    . This would display the value of the variable. If you wanted to put both text and variable(s) you would need to have this code
    Code:
    echo "text and " + $variable;
    . This would display the value text and whatever the value of $variable is.

    VARIABLES

    To define a varible you simply put "$" then the name you want to call the variable such as "a". That varible would be called "$a". When using it you must refer to it as "$a". "$A" is a completely different variable and would draw errors if you were referring to "$a" or it would screw your end result up. To give a variable a value you would use this code
    Code:
    $a = "1";
    . This would make the variable "$a" have the value of 1. If the value is another variable you would put this
    Code:
    $a = $A
    . This would mean that the value of "$a" is equal to "$A". Again you must have the semicolon after for the same reason as the echo function.

    I will make more tutorials about php when I have the time to write them. For now this is what you can start with.
     
  3. Unread #2 - Jul 28, 2017 at 10:02 PM
  4. RSGPokerx
    Joined:
    Jul 28, 2017
    Posts:
    29
    Referrals:
    0
    Sythe Gold:
    37

    RSGPokerx Member
    Banned

    Simple Php Tutorial.

    ty for this bro
     
  5. Unread #3 - Jul 31, 2017 at 7:25 AM
  6. Limea
    Joined:
    Jul 31, 2017
    Posts:
    11
    Referrals:
    0
    Sythe Gold:
    11

    Limea Newcomer
    Banned

    Simple Php Tutorial.

    Thanks for this, will be useful for the people interested in coding :rolleyes:
     
  7. Unread #4 - Aug 8, 2017 at 10:44 AM
  8. Sensi Skunk
    Joined:
    Aug 8, 2017
    Posts:
    18
    Referrals:
    0
    Sythe Gold:
    30

    Sensi Skunk Newcomer
    Banned

    Simple Php Tutorial.

    Thanks
     
  9. Unread #5 - Aug 13, 2017 at 10:29 AM
  10. Erza88
    Joined:
    Aug 8, 2017
    Posts:
    481
    Referrals:
    0
    Sythe Gold:
    939

    Erza88 Forum Addict
    Banned

    Simple Php Tutorial.

    Wow, this thread is ancient! Thanks for sharing this nonetheless!
     
< Dating tips 101 | >

Users viewing this thread
1 guest


 
 
Adblock breaks this site