Skip to content

PHP remove HTTP header

Something, I think Apache, adds these HTTP headers to all responses generated by PHP scripts: Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 This works ok for actual dynamic pages, but I have some page that, while generated by PHP, are most…

PHP comments: # vs. //

Lately I’ve been using # instead of // for doing single line comments inside my code. However, I see most of the people prefer //. Is there a particular reason for preferring them instead of #? Performance? File weight? Anything? Answer It doesn’t change a single thing, I’d say ; it’s …

$date + 1 year?

I’m trying to get a date that is one year from the date I specify. My code looks like this: It’s returning the wrong date. Any ideas why? Answer To add one year to todays date use the following: For the other examples you must initialize $StartingDate with a timestamp value for example: Try this o…

Can’t save php.ini

I have PHP for FastCGI installed on Windows 7 through the Web Platform Installer. I need to edit php.ini to enable logging, but I’m not able to overwrite the existing file, apparently because …

PHP output to command line

I start my script from command line and it outputs things as they happen but a week ago it stopped outputing and now outputs everything when script finishes. I have ob_start() but as I know this does not effect command line output. Answer You need to remove ob_start()… try this code on the command line,…