Jump to content

Syntax Problem


timlondon

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.