tags:

views:

138

answers:

4

I'm creating a test server for a new client that has and older version of PHP that only uses the <? tags but the latest version of PHP is expecting <?php tags.

I'm looking for the version I need to install so that I can run the old code without changing any of it.

+13  A: 

You just need to enable short_open_tag to use that short version of the standard PHP tags <?php.

But I wouldn’t do that but just replace the short tags <? with the standard PHP tags <?php for portability.

Gumbo
You are correct, just be careful replacing '<?' with '<?php' to ensure that you also replace '<?=' with '<?php echo' since <?php= does not work.
Wally Lawless
Adding to @Wally, you don't want to replace the `<?` in <?xml` either.
chelmertz
+6  A: 

To the best of my knowledge, <?php has always been available. <? aka short tags are only available when the directive is allowed in php.ini

Mike B
+3  A: 

the short tag can be used in any version of PHP. You just need to allow it in the php.ini: http://php.net/manual/en/ini.core.php

dnagirl
A: 

Out of curiosity I downloaded some of the older versions of PHP from the museum, and all of the examples in version 'php-2.0' only used <? to open the tags. So I'm going to assume version 1.0 and 2.0 only used <? and <?php was introduced in either a later version of 2 or 3.0.

I really wouldn't suggest using any of the old versions of PHP though, mess around with the php.ini and you should be able to get the script working on 4.0.

evolve