PHP Tutorials
Basic PHP File Handling — Create, Open, Read, Write, Append, Close, and Delete
I don't do a great deal of file handling in my PHP code -- most of my customers don't have a need for it or there's no room for file creation in the already tight budget. On the rare occasion that I do need to...
PHP Shorthand If / Else Examples
In looking at my Google Analytics statistics, I see a lot of visitors searching for PHP shorthand if/else (ternary) information. I've gone through my code library and picked out some examples of ternary operator usage. Basic True / False Declaration Conditional Welcome Message Conditional Items Message Conditional Error Reporting...
PHP Form Helper – Submit Listener
Unfortunately for me, web forms a big part of my day. It's not that web forms are difficult, it's that they're so damn time consuming. Validation, formatting, and processing are a must for web forms and the redundancy that goes into performing the task...
PHP Alexa Rank Fetcher Class
The most well known online website popularity measuring stick appears to be Alexa. Alexa provides a wealth of information on a given website, most notably: Popularity rank (the most important one) Reach In-links Speed Alexa provides this information in many useful formats, including XML. Using the XML...
Download a URL’s Content Using PHP cURL
Downloading content at a specific URL is common practice on the internet, especially due to increased usage of web services and APIs offered by Amazon, Alexa, Digg, etc. PHP's cURL library, which often comes with default shared hosting configurations, allows web developers to complete this...
Convert Key => Value Arrays Into Standard Variables In PHP
I don't mind using arrays -- in fact, I love them. They're easy to use and hold collections of information well.I don't always want to use arrays though. Why use:when you could simply use:So how can we get rid of the array part of...
Using PHP Generic Objects To Organize Your Code
I like using PHP classes to keep my code organized and easy to maintain. I know that they consume more memory than simply using an array or variable system, but if memory is an issue, I'd get more memory. Saving time by coding in...
Compress Your XHTML Page Output Using PHP Output Buffers
Us programmers love to keep our code readable and neat, which is why we use hundreds of tabs and line feeds in our code. The problem with doing this in the web programming world is that our users don't care about our neatly indented code.
Generate Search Engine Friendly URLs with PHP Functions
Generating search engine friendly (SEF) URLs can dramatically improve your search engine results. There's a big difference between "/post.php?id=2382" and "/great-php-functions/". Having search engine friendly URLs also gives the user an idea of what will be on the page they are clicking on if...
PHP / MySQL Database Optimization Function
After frequent record deletion from your MySQL database tables, your tables can acquire overhead. Overhead is empty space left inside the database table due to the deletions. A great way to speed up your MySQL database, not to mention keep it compact, is to...