/    Sign up×
Community /Pin to ProfileBookmark

<?=$foo ?> not being parsed.

I had a look at a script I wrote ages ago and noticed that part of it was:

[CODE]<?=$message ?>[/CODE]

and this was getting completely ignored by the PHP parser, in fact, it was showing up in the source code.
I’m using WAMP and I’ve updated a few times since looking at this script, so I assume that some setting has fallen out of place but I wouldn’t know where to start in fixing this.

Any clues?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJun 11.2006 — Your PHP installation would have to have "short tags" enabled for that to work. However, that can be problematic, as "<? xml version='1.0'>" would be interpreted as PHP code; so current versions of PHP do not have short tags turned on by default. So your options are:

  • 1. Search-and-replace "<?=" with "<?php echo" (and "<? " with "<?php "),

  • 2. Enable short_open_tag globally in your php.ini, or

  • 3. Enable short_open_tag for a given directory via .htaccess.


  • In the long run, I would go with option 1 as it provides the best portability for the code.
    Copy linkTweet thisAlerts:
    @felgallJun 11.2006 — If you decide to go with having short tags enabled then you need to convert

    <? xml version='1.0'>

    to

    echo '<'.'?xml version="1.0"?'.'>';

    or similar so that the <? ?> in the XML declaration don't get interpreted as PHP tags.
    ×

    Success!

    Help @the_tree spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.5,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,

    tipper: @Samric24,
    tipped: article
    amount: 1000 SATS,
    )...