Skip to main content

Posts

Showing posts from October, 2012

PHP Best Practices

This guide will give you solutions to common  PHP  design problems. It also provides a sketch of an application layout that I developed during the implementation of some  project s. php .ini quirks Some settings in the  php .ini control how  PHP  interpretes your scripts. This can lead to unexpected behaviour when moving your application from development to the productive environment. The following measures reduce dependency of your code on  php .ini settings. short_open_tag Always use the long  PHP  tags:  php echo "hello world"; ?> Do not use the echo shortcut  . asp_tags Do not use ASP like tags:  <% echo "hello world"; %> gpc_magic_quotes I recommend that you include code in a global include file which is run before any $_GET or $_POST parameter or $_COOKIE is read. That code should check if the gpc_magic_quotes option is enabled and run all $_GET, $_POST and $_COOKIE values through the  stripslashes ...