PHP programming tutorials

PHP: Camel Case to Spaces or Underscore

contributed by David Kirk on March 19, 2010 under PHP programming

Recently while working on a project, I found I needed to convert camelcase strings to space-separated strings. This same technique will work if you want to convert camelcase to underscore separation as well.

 

Pear Fix for “Error: Unable to Unpack”

contributed by David Kirk on February 12, 2009 under PHP programming

Recently while trying to install some Pear packages, I received an odd “Error: Unable to Unpack” message. A search for this error message found a lot of complaining people and not a lot of answers. I finally figured out the cause and the fix for this common Pear problem.

 

PHP: Upload Files to the Server

contributed by William_Wilson on September 30, 2008 under PHP programming

With PHP, it is simple to upload any file to your server.

 

PHP: Print the current year for copyright notices

contributed by qmchenry on March 8, 2008 under PHP programming

Hardcoding the year in a copyright notice is an easy way to get a blog or other website started, just placing the starting and ending years next to the copyright symbol. We have the very best of intentions to change this number right after the big ball drops in Times Square each year. We’re also human and, all too often, I see websites with copyright notices that are years behind. If your website is PHP-powered, this quick bit of code will put the current year in your copyright notice and off of your mind.

 

Make Wordpress Stop Replacing Double Dash with Em-dash

contributed by johnnythawte on November 20, 2006 under PHP programming

Wordpress by default replaces the double dash (–) with an em-dash character. If you are showing code or programming examples this will cause your visitors unnecessary confusion. This recipe shows the simple way to turn that behavior off.

 

PHP: Delete or expire a browser cookie

contributed by qmchenry on July 14, 2006 under PHP programming

Cookies may be created with an expiration time. It may become necessary to expire a cookie before the expiration time such as when a user logs out of a cookie-based authentication web application. This recipe describes expiring a cookie.

 

PHP: Read a browser cookie value

contributed by qmchenry on under PHP programming

Once your web application has set a cookie in a user’s browser, it is a simple matter to retrieve that value in subsequent page requests. This recipe describes reading a value from a cookie in PHP.

 

PHP: Set or create a simple browser cookie with setcookie

contributed by qmchenry on under PHP programming

Web applications overcome the lack of session support in the HTTP protocol primarily through the use of cookies. Transparent to the user and simple for the web developer, cookies provide the foundation of keeping up with who a web user is, where they’ve been, and what they had for lunch. Well, who and where, anyway.