Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Can PHP alter a PHP file?
What I am wondering is. I have a PHP file all it has in it is just one variable and variable content. My question would be could I pull this variable content into a PHP read function then preg_match it to alter the PHP variables content.
The reason its just a variable on its own is the variable is the current VAT rate. I understand the alternative would be to use a text file but that would mean altering the sites content on several pages if it can be done this way I'd rather give it a go.
Thanks in advance
1 Answer
- just "JR"Lv 76 years ago
Not sure what you are trying to do...
How is the varible stored? As a numeric value, or as a text in Php?
If a text, use $strg = file_get_contents("filename");
Alter the string in it, then _put_contents("fielname", $strg);
Otherwise, it would be cleverer to put that variable as a constant:
define ("VAT", 17.5);
into an "include" file.
And use VAT in all your calls
==> echo "VAT charge: " .VAT;