Code Snippet Explanation Requested

Discussion in 'PHP' started by denniswimer, Nov 16, 2007.

  1. #1
    I have inherited a php application that includes the following code snippet:
    
    <?=$User->get_css( "" );?>
    
    Code (markup):
    I do not understand the prepended '='. I have searched the php manual, but cannot find a description of what this does. Am I just missing it in the php manual?
     
    denniswimer, Nov 16, 2007 IP
  2. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #2
    It's designed to output the contents of an expression without using print or echo.

    I don't remember if asp_tags has to be on in php.ini for it to work or not.
     
    joebert, Nov 16, 2007 IP
  3. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #3
    'asp_tags' doesn't affect it though 'short_open_tag' does. Seeing as 'short_open_tag' is being deprecated, you will eventually have to replace it with the 'long hand' version:
    <?php echo $User->get_css( "" );?>
     
    TwistMyArm, Nov 16, 2007 IP
  4. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #4
    Never would have thought you can't do this,
    <?php='stuff';?>
    Code (markup):
    but apparently you can't.
    The = throws an unexpected character error.
     
    joebert, Nov 16, 2007 IP