I am looking to use PHP to open a file (see example below), search it line by line for a string $colour and replace everything after the = with $value. file.txt before: If my $value is “1” and my colour is “blue”, my file should change to: My code so far is: However this only gets as f…
Tag: file-writing
How does Laravel Artisan created php files with properly formatted lines
This is just a general question, how does Laravel Artisan able to create proper .php file e.g. make:controller with the correct formatting and line breaks? Is there a good PHP script which can help one develop similar php codes. Thanks Answer PHP files are just text files, you can easily create them with any …