RE: [PHP] Anyone have a tool/script to convert <? to <?php (but not <?=) [deprecated]
| From: | Daevid Vincent | Date: | Fri, 14 Feb 2014 19:43:18 +0000 |
| Subject: | RE: [PHP] Anyone have a tool/script to convert <? to <?php (but not <?=) [deprecated] | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-322874@lists.php.net to get a copy of this message | ||
As far as I'm aware, <? Has been deprecated and so having code that relies
upon it could require us to stay at certain PHP version levels that support
it. Or has this idea been abandoned? I remember lots of flurry about it, but
as I recall it was over the confusion where people thought that <?= was
going away when it was only to be <? (which most people agreed was
acceptable to be rid of)
http://www.php.net/manual/en/language.basic-syntax.phptags.php
http://asoke.wordpress.com/2012/01/06/short-open-tags-will-be-removed-in-php
-6/
> -----Original Message-----
> From: Joshua Kehn [mailto:josh.kehn@gmail.com]
> Sent: Friday, February 14, 2014 11:21 AM
> To: Aziz Saleh
> Cc: Daevid Vincent; php-general@lists.php.net
> Subject: Re: [PHP] Anyone have a tool/script to convert <? to <?php (but
not
> <?=)
>
> +1...
>
> You could not be so picky about inherited code and just change them when
> you come across them.
>
> --jk
>
> On 14 Feb 2014, at 10:53, Aziz Saleh wrote:
>
> > What I posted (and all the others) would work, replacing all instances
> > of
> > "<? " (notice the space) with "<?php " should work, it will
> > leave all
> > existing <?= and <?php alone (since having a space after ? and before
> > =/php would produce a parser error.
> >
> > Not sure why you are saying that spaces are irrelevant thou.
> >
> >
> > On Fri, Feb 14, 2014 at 1:34 PM, Daevid Vincent <daevid@daevid.com>
> > wrote:
> >
> >> *sigh*
> >>
> >> <?=$foo?> is perfectly valid so is <?=$foo;?> or any combination WITH
> >> SPACES OR NOT.
> >> If this were trivial, I wouldn't have asked the list. I've been
> >> coding PHP
> >> since 1996. ;-)
> >>
> >> So if you have <? you have to make sure it doesn't have a '=' after
> >> the
> >> '?' to convert to '<?php'
> >>
> >> Spaces are irrelevant and can NOT be relied upon as a unique feature.
> >>
> >>> -----Original Message-----
> >>> From: Daevid Vincent [mailto:daevid@daevid.com]
> >>> Sent: Wednesday, February 12, 2014 2:57 PM
> >>> To: php-general@lists.php.net
> >>> Subject: RE: [PHP] Anyone have a tool/script to convert <? to <?php
> >>> (but
> >> not
> >>> <?=)
> >>>
> >>> Thanks guys for the replies so far, however, if it were a simple
> >>> search
> >> and
> >>> replace I wouldn't have to ask ;-)
> >>>
> >>> The trick is that "<?=" is valid and legal and I want to keep those.
> >>> I
> >> only
> >>> want to change if they are specifically "<?"
> >>>
> >>> Maybe there is some regex guru out there that knows the magic
> >> incantation.
> >>>
> >>> Related, for extra credit it drives me bonkers to see this:
> >>>
> >>> Hello <?= $username; ?>
> >>>
> >>> Note the end semicolon on the variable. I'd want to strip all those
> >>> off
> >> too,
> >>> but that is also not a trivial task if you think about it as it can
> >>> only
> >> be
> >>> removed if proceeded with <?=
> >>>
> >>>
> >>>
> >>> --
> >>> PHP General Mailing List (http://www.php.net/)
> >>> To unsubscribe, visit:
> >>> http://www.php.net/unsub.php
> >>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>