basic programs in php

Discussion in 'Programming' started by leena25, Jun 24, 2011.

  1. #1
    i need simple programs in php....
     
    leena25, Jun 24, 2011 IP
  2. mfscripts

    mfscripts Banned

    Messages:
    319
    Likes Received:
    4
    Best Answers:
    8
    Trophy Points:
    90
    Digital Goods:
    3
    #2
    Ok, anything more specific than that?
     
    mfscripts, Jun 25, 2011 IP
  3. leena25

    leena25 Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I need sample php program ...

    1. If else conditions

    2. Switch case

    3. Loops
     
    leena25, Jun 25, 2011 IP
  4. The Webby

    The Webby Peon

    Messages:
    1,852
    Likes Received:
    30
    Best Answers:
    1
    Trophy Points:
    0
    #4
    How about a "Please" and a "Thank you"?
    http://php.net/manual/en/control-structures.elseif.php
    if($var1 == $var2){
    // do this
    }
    else if($var1 == $var 2){
    // do that
    }
    else {
    // do me
    }
    PHP:
    http://php.net/manual/en/control-structures.switch.php
    switch($var1){
    case "value1":
    //do this
    break;
    case "value2":
    //Do that
    default:
    //Do me
    }
    PHP:
    http://php.net/manual/en/control-structures.for.php
    http://php.net/manual/en/control-structures.while.php
    http://php.net/manual/en/control-structures.do.while.php
    http://php.net/manual/en/control-structures.foreach.php
    /* For Loop */
    for($i=0;$i<10;$i++){
    // Do it
    }
    
    /* While Loop */
    while($i<10){
    // Do it
    }
    
    /* Do While Loop */
    do{
    // Something
    }
    while($i<10)
    
    /*For Each Loop */
    foreach($array as $key=>$value){
    // Do something with $key and $value
    }
    PHP:
     
    Last edited: Jun 25, 2011
    The Webby, Jun 25, 2011 IP
  5. BRUm

    BRUm Well-Known Member

    Messages:
    3,086
    Likes Received:
    61
    Best Answers:
    1
    Trophy Points:
    100
    #5
    Bah, you're too kind Webby. People should learn PHP before asking questions like these.
     
    BRUm, Jun 25, 2011 IP
  6. The Webby

    The Webby Peon

    Messages:
    1,852
    Likes Received:
    30
    Best Answers:
    1
    Trophy Points:
    0
    #6
    You are absolutely right, I just didn't want to come out too harsh.. But I really wonder if she can make any head or tail out of these codes...

    But what really annoys me, when people ask questions such as in this thread: http://forums.digitalpoint.com/showthread.php?t=2213788
    And the poster claims to be a php coder....
     
    The Webby, Jun 25, 2011 IP
  7. leena25

    leena25 Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thanks for ur reply.. its very useful to me ...:)
     
    leena25, Jun 27, 2011 IP
  8. smartyseo

    smartyseo Member

    Messages:
    164
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #8
    smartyseo, Jun 28, 2011 IP
  9. adslvlc

    adslvlc Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    php . net ..
     
    adslvlc, Jul 5, 2011 IP