A fresh mix of code snippets and tutorials

Category Archive: PHP

Posts about PHP

Page 5 of 6

Add Custom Info to PHP System Log

Here is a quick function for adding custom information to the system log via PHP.

Recursively display images via PHP

Here is an easy way to display all images in a directory — including images contained in sub-directories.

Add links to HTML/CSS Validator

Here are some notes and markup examples for adding links to the W3C’s online HTML and CSS validators. This will enable your visitors to check any page on your site.

PHP: Target IE less than 9

Recently I haven’t had time to bother with old versions of IE (less than 9), so I use the following PHP function to target IE 6, 7 and 8.

PHP: Get current URL

Nice lil slab of PHP to get the current URL. Useful for a wide variety of applications, nice one to have in the tool belt.

WordPress get all user emails

Quick snippet to get all user emails in WordPress.

Structure of $_FILES array

Working with USP Pro involves a lot of $_FILES manipulation. I tend to forget how the array is structured, so I’m posting it here for ez reference.

PHP String Cleaner

Here is a PHP snippet for cleaning or sanitizing variables.

WordPress 404 email alerts

Here is a customized plug-n-play PHP script for reporting 404 errors via email. No editing required, just clean email alerts for each 404 error.

Redirect HTTP to PHP via .htaccess

Here is how to redirect specific URL requests to a PHP script for further processing, etc. Very useful for monitoring HTTP activity, logging errors, and more.

(More) secure PHP includes

Quick tip for securing your PHP includes, place them above your web-accessible root directory.

Display Twitter count in plain text

Twitter’s constant changes make it necessary to update techniques for otherwise simple tasks such as displaying your Twitter count via PHP.