mslater Posted May 24, 2006 Share Posted May 24, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/10394-fwrite-and/ Share on other sites More sharing options...
zq29 Posted May 25, 2006 Share Posted May 25, 2006 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 Link to comment https://forums.phpfreaks.com/topic/10394-fwrite-and/#findComment-38830 Share on other sites More sharing options...
mslater Posted May 25, 2006 Author Share Posted May 25, 2006 [!--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. Quote Link to comment https://forums.phpfreaks.com/topic/10394-fwrite-and/#findComment-38897 Share on other sites More sharing options...
wildteen88 Posted May 25, 2006 Share Posted May 25, 2006 Could you post your code here please so we can see what you are doing.PHP shouldn't shouldn't "halt" when you place <?php in a variable. Quote Link to comment https://forums.phpfreaks.com/topic/10394-fwrite-and/#findComment-38898 Share on other sites More sharing options...
nogray Posted May 25, 2006 Share Posted May 25, 2006 try to add a ; after the code[code]$copy = "<?PHP";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10394-fwrite-and/#findComment-38967 Share on other sites More sharing options...
mslater Posted May 25, 2006 Author Share Posted May 25, 2006 [!--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. Quote Link to comment https://forums.phpfreaks.com/topic/10394-fwrite-and/#findComment-38968 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.