What is difference between print and echo

Discussion in 'PHP' started by Hussy, Jul 10, 2010.

  1. #1
    Hi...

    friend


    What is difference between print and echo


    thanks :eek:
     
    Hussy, Jul 10, 2010 IP
  2. Stephen Root

    Stephen Root Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Not much. PHP manual says:
    print — Output a string
    echo — Output one or more strings

    So I guess the difference is that with echo you can output more than one string :) Personally I always use echo for strings and print_r to get arrays.
     
    Stephen Root, Jul 10, 2010 IP
  3. Johnta

    Johnta Peon

    Messages:
    101
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Print returns a value like a php function would :)
     
    Johnta, Jul 10, 2010 IP
  4. balaji153

    balaji153 Peon

    Messages:
    96
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    $var = array(1,2,3,4,);

    if you echo $var; the output will be like this array

    but if you print_r($var) i won't tell your try in your machine......
     
    balaji153, Jul 10, 2010 IP