Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 15 of 15
  1. #1
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts

    PHP newbie looking for help

    Hey all im a real beginner to PHP, do any of you have any ideas of simple scripts i can write to get practise?, i will post the script when i have finished so you can check if its ok, heres your chance to really help someone,
    Thanks
    Rafiki

  • #2
    Regular Coder
    Join Date
    Jul 2004
    Posts
    201
    Thanks
    8
    Thanked 1 Time in 1 Post
    your best starting reading some tutorials and then practice what they say.

    You might want to try starting with adding some numbers together and playing around with varibles.

  • #3
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    I read a few tutorials and done the "Hello world" but following a tutorial is easy, i want to know if i can come up with simple scripts, then move on to more intermediate scripts, thanks for the advice though

  • #4
    Regular Coder
    Join Date
    Jul 2004
    Posts
    201
    Thanks
    8
    Thanked 1 Time in 1 Post
    practice some loops, they are easy from a tutorail but once your one ur own they get a bit intimadating.

  • #5
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    OK you got any idea wat to do with the loops or just make an example?

  • #6
    Regular Coder
    Join Date
    Jul 2004
    Posts
    201
    Thanks
    8
    Thanked 1 Time in 1 Post
    try getting the code to count to ten.

    fist like this:

    1, 2, 3, 4 etc

    and then down the page

    1,
    2,
    3,
    4,

  • #7
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    PHP Code:
    <?php

    $i
    =5;
    $o=$i--
    $p=$o--
    $q=$p--
    $r=$q--
    while(
    $i!=0);
        
    {
    echo 
    "$i $o $p $q $r";
    }
    ?>
    remember i said i got zilch experience, but this any good?, oh and i currently have no hossting to test scripts on

  • #8
    Regular Coder
    Join Date
    Jul 2004
    Posts
    201
    Thanks
    8
    Thanked 1 Time in 1 Post
    Quote Originally Posted by rafiki
    PHP Code:
    <?php

    $i
    =5;
    $o=$i--
    $p=$o--
    $q=$p--
    $r=$q--
    while(
    $i!=0);
        
    {
    echo 
    "$i $o $p $q $r";
    }
    ?>
    remember i said i got zilch experience, but this any good?
    erm no, lol

    you could do that without the while loop, all you have done basicly is:

    echo "54321";

    but nice try. I would have done it like this,

    $i = 5;
    while ($i > 0) {
    echo "$i,<br>";
    $i--;
    }

    that should echo
    5,
    4,
    3,
    2,
    1,

    try it, get youself some hosting and play around.

    tripod have it free, or here is a cheap host that I use:

    http://platinumhost.co.uk/?p=Order

    Start from £0.69

  • #9
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    i was gonna do it like that but that seemed so tutorial style im looking to do a little more advanced than that
    thanks tho

  • #10
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    any other ideas for practise? ill try do everything basic now lol

  • #11
    Registered User
    Join Date
    Oct 2004
    Posts
    592
    Thanks
    0
    Thanked 1 Time in 1 Post
    First, learn all basic rules of a php programming.
    Stick to php manual which is better than tutorials.
    Yeah php manual is exactly like tutorial book than usual manual.

    It has copy and paste code already.
    Read the explanation. Then paste it to your php editor.
    ( For practise use php expert editor <http://www.ankord.com/phpxedit.html>
    It has built-in http server, and you don't have to save every file of your practice.)

    Next again,if you want to extend your power of php, download various extensions of GD, PDFLib ..etc. Try testing as said on php manual. Test on both Windows and any Unix variant for php.

  • #12
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    any more ideas??

  • #13
    Regular Coder
    Join Date
    Jul 2004
    Posts
    201
    Thanks
    8
    Thanked 1 Time in 1 Post
    iota, i didnt want to confuse him with setting up his own server, but that editor sounds nice, il give it a go. A built in http server is a good idea.

    If your looking for something else to work with, try arrays,

  • #14
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    for some reason i cant dload that program heres a bit of coding with an array
    PHP Code:
    <?php

    &drinks = array("Beer","Cider","lager");

    &
    drinks[0] = "Beer";
    &
    drinks[1] = "Cider";
    &
    drinks[2] = "lager";

    echo 
    "We serve the following beverages &drinks[0],
     &drinks[1] and &drinks[2]"
    ?>
    this any better?

  • #15
    Regular Coder
    Join Date
    Jul 2004
    Posts
    201
    Thanks
    8
    Thanked 1 Time in 1 Post
    funny, i just seen tht script in another post here.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •