SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: echo or print

Hybrid View

  1. #1
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is the difference between echo and print in PHP, and what is the syntax

    eg

    print ("hello"); or print "hello"; and same for echo?

    Another thing.

    In php, does the start have to begin with:

    <?php or can it begin with <?

    ??

    What is the best PHP tutorial you ever read?
    Thanx

    Peter
    <Edited by petesmc on 12-09-2000 at 04:51 PM>

  2. #2
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    [INCLUDED IN ABOVE POST]
    <Edited by petesmc on 12-09-2000 at 04:52 PM>

  3. #3
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am pretty sure the format for echo and print are the same and additionally with print and probably echo though I am not sure you can use

    print ''

    So you can safely use double quotes in your html without having to escape them

    I always use print

    You can use <? ?>
    as long as the short_tags directive in the php.ini file is set to On which it defaults to
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  4. #4
    Fluffy Kitten Programmer~ Elledan's Avatar
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    1,356
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by petesmc

    Another thing.

    In php, does the start have to begin with:

    <?php or can it begin with <?
    A PHP script always starts with <?php (php4 that is) and ends with ?>

    What is the best PHP tutorial you ever read?
    The best PHP tutorial I've ever read was Kevin Yank's tutorial: "How to build a Database-driven web site using PHP and mySQL."
    www.nyanko.ws - My web-, software- and game development company.
    www.mayaposch.com - My personal site and blog.

  5. #5
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you change the php.ini file?

    Chn you have multiple values>?

    e.g <?php and <?

  6. #6
    SitePoint Evangelist
    Join Date
    Jul 2000
    Location
    Warwickshire, England
    Posts
    557
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ... like Freddy says, also you can configure <? ?> to be whatever you want in your php ini file.


Bookmarks

Posting Permissions

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