Does php 5.2 still support <?=?>

Discussion in 'PHP' started by PinoyIto, Sep 20, 2007.

  1. #1
    I have upgraded my server to 5.2 and now getting problem with using <?=?> instead of echo when inserting the code in html documents.

    It requires me to change all these <?=?> code to <?php echo "" ?> , is there a way to fix the problem or I really need to modify all my script?
     
    PinoyIto, Sep 20, 2007 IP
  2. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #2
    You should never have <?= or "short tags" anyway as some hosts and as you have witnessed, default settings, disable short tags.

    Change short_open_tag = Off to short_open_tag = On in your php.ini to change this.
     
    krt, Sep 20, 2007 IP
  3. frankcow

    frankcow Well-Known Member

    Messages:
    4,859
    Likes Received:
    265
    Best Answers:
    0
    Trophy Points:
    180
    #3
    Yeah, I don't think it's about the PHP version, I believe it's the hosting settings
     
    frankcow, Sep 20, 2007 IP
  4. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #4
    <?= requires short_open_tags to be enabled for it to work.

    Try setting it to on your your php.ini file or via a call to ini_set.

    Having said that I thought that short_open_tags was deprecated and being removed at some point soon (maybe not until PHP 6) so I'd just go and fix it now, anyway.
     
    TwistMyArm, Sep 20, 2007 IP
  5. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #5
    I think it's his local server.

    Yes, and I think that is the problem, PHP 5.2 disables short_tags by default, good riddance :)
     
    krt, Sep 20, 2007 IP