What does a special set of tag <? = and ?> do in PHP ??

Discussion in 'PHP' started by tomsign, Jul 24, 2010.

  1. #1
    Hi,,


    what does special set of tag <? =and ?> do in PHP?



    Thanks in advance:)
     
    tomsign, Jul 24, 2010 IP
  2. Zeh.

    Zeh. Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <?=$variable?> = <?php echo $variable; ?>

    But it's not recommended to using this.
     
    Zeh., Jul 24, 2010 IP
  3. qrpike

    qrpike Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    short tag terms, must have it enabled to work. Dont use them as some servers dont support or have them turned on. Always make your scripts as cross-server compatible as possible.
     
    qrpike, Jul 24, 2010 IP
  4. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What qrpike said, never use them. I used to, until I had to move a website to another server that didn't support them.
    They will be gone by the time PHP 6 arrives as well.
     
    Deacalion, Jul 24, 2010 IP
  5. Andrew J

    Andrew J Peon

    Messages:
    32
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It's a short form of echo. For example if you did:

    <?=$myVar?>
    PHP:
    It would output the value of $myVar.

    It is however deprecated so I don't recommend you use it.
     
    Andrew J, Jul 24, 2010 IP
  6. sandy_joy

    sandy_joy Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hi, Before writing anymore I Suggest you that, you don't use that style for writing some code with php
    <?
    $a = 4;
    echo $a;
    ?>
    Because this tag style is the very simple that follows the style of a Standard Generalized Markup Language (SGML) processing instruction.when you use that style you must,open/enable short_open_tag setting in your config file or compile PHP with short tags enabled.

    then you must use like,
    <?php
    $a = 4;
    echo $a;
    ?>
    that's Style we use follow from XML Style.
     
    sandy_joy, Jul 27, 2010 IP
  7. Chuckun

    Chuckun Well-Known Member

    Messages:
    1,161
    Likes Received:
    60
    Best Answers:
    2
    Trophy Points:
    150
    #7
    As previously mentioned, short tags are not good! They are very commonly a cause of incompatibility between servers.

    In very basic terms, always open and close tags in the standard format of
    open: <?php
    close: ?>

    This way you can be sure that a) It will work on all PHP enabled servers, and b) It will never be superseded.. As this is the standard PHP tag format.

    Chuckun
     
    Chuckun, Jul 27, 2010 IP