Jump to content

Recommended Posts

I've just had to reinstall php due to a system upgrade and my previous install worked using <? to open when code was being embedded within html. This worked fine on all of my pages. Subsequent to the re-install however, I now need to use <?php instead. This is very frustrating since I will need to amend the coding of about 50 pages. Is there a way I can alter the configuration of php so that it accepts <?    ?????

 

I'm using 5.2.0

Link to comment
https://forums.phpfreaks.com/topic/37464-syntax-problem/
Share on other sites

preg_replace("<\?(?!php)","<?php",$line);

 

Loop through each line in each file, and have that in the middle of the loop ($line being the line from the file you're currently on).

 

That should work as a PHP script to do it for you.

 

Interesting...using PHP to fix PHP...

 

[EDIT]Added in negative lookahead to the regex, that way you don't replace <?php with <?phpphp.

Link to comment
https://forums.phpfreaks.com/topic/37464-syntax-problem/#findComment-179135
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.