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 6 of 6
  1. #1
    Banned
    Join Date
    Sep 2011
    Posts
    140
    Thanks
    17
    Thanked 0 Times in 0 Posts

    echo vs print.. any difference?

    Is there actually any difference or is one of them in use?

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,474
    Thanks
    63
    Thanked 537 Times in 524 Posts
    No, there is no difference. echo and print are the same thing.
    Last edited by Inigoesdr; 09-20-2011 at 03:36 PM.
    I can't really think of anything to write here now...

  • #3
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,538
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts
    I find different answers, but this seems like the best explanation:
    http://www.jonlee.ca/php-tidbit-echo-vs-print/


    .

  • #4
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,474
    Thanks
    63
    Thanked 537 Times in 524 Posts
    Actually that article is wrong.

    If you look at print on the php website, take a look at return values:

    Returns 1, always.
    I can't really think of anything to write here now...

  • #5
    Banned
    Join Date
    Sep 2011
    Posts
    140
    Thanks
    17
    Thanked 0 Times in 0 Posts
    Thank you, mlseim.
    Last edited by Inigoesdr; 09-20-2011 at 03:37 PM.

  • #6
    Regular Coder
    Join Date
    Sep 2011
    Posts
    128
    Thanks
    2
    Thanked 21 Times in 21 Posts
    Echo has a shortcut to use it: <?=$var?>


  •  

    Posting Permissions

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