Jump to content

fwrite and <?PHP


mslater

Recommended Posts

Hello all,

I have a script that creates a new PHP file. I need the PHP file to actually contain the <?PHP and ?> lines, but when the script reaches the body of copy and finds "<?PHP" it comes to a hault.

Example
[code]$copy = "<?PHP"[/code]

Is there anyway to comment that line so PHP will ignore it and write it into the new file?
Link to comment
Share on other sites

[!--quoteo(post=376940:date=May 25 2006, 05:32 AM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ May 25 2006, 05:32 AM) [snapback]376940[/snapback][/div][div class=\'quotemain\'][!--quotec--]
What do you mean by "comes to a halt"? Does it give you any error messages? It shouldn't have a problem with assigning the value "<?php" to a variable...
[/quote]
It comes to a hault. It stops. No error message. The script works fine up to where the variable shows up and then stops. Granted it picks up whatever is AFTER "<?php" but the loose " at the end leaves everything a might screwy.
Link to comment
Share on other sites

[!--quoteo(post=377079:date=May 25 2006, 01:51 PM:name=nogray)--][div class=\'quotetop\']QUOTE(nogray @ May 25 2006, 01:51 PM) [snapback]377079[/snapback][/div][div class=\'quotemain\'][!--quotec--]
try to add a ; after the code
[code]
$copy = "<?PHP";
[/code]
[/quote]
My apologies for not adding it, but there is a ";" after the code.

I can replace that variable with any other information. However, <?, <?PHP and <% cuase problems when being used as variables. I tried slashes, trying to comment it out as I would double quotes, etc, but it's not working.

I believe I've worked a way around it. I wrote the template into a separate file and instead of dumping the code into a new file, I have the script copy the file from one location to another and rename it to what I need.
Link to comment
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.