Jump to content

Make PHP make PHP


absorr

Recommended Posts

I know that you can use file_put_contents to write a file and that you can use \ to cancel things, but though If I were to generate a PHP file through this (unless there is a more efficient way) what would I need to cancel and also how would I make it start a new line?

Link to comment
Share on other sites

Technically, you never really need to start a new line in code. That's only to improve readability. You can use \n or \r\n to put a new line. The only characters you really need to escape are the type of quotation marks used around the string that has the code in it. I don't really recommend generating PHP, though. Why do you need to do that? The only time I ever did that was to create a config file with variables in it upon installation. Though I've used different methods for that too.

Link to comment
Share on other sites

Technically, you never really need to start a new line in code. That's only to improve readability. You can use \n or \r\n to put a new line. The only characters you really need to escape are the type of quotation marks used around the string that has the code in it. I don't really recommend generating PHP, though. Why do you need to do that? The only time I ever did that was to create a config file with variables in it upon installation. Though I've used different methods for that too.
Thank you! The reason is for that server manager that I've been posting for help on recently. I keep having to manually put in my clients' information in and I want to make it generate the files based on the information they put into the form field. That just gave me the last thing i needed to make that work!
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...