Upcoming Panel on The Future of PHP

On November 17, Engine Yard will host a discussion around the future of PHP. Engine Yard describes the event, “If you are a PHP developer using PEAR and Pyrus, we invite you to join us this week as we explore the future of PEAR and Pyrus. We’ll be discussing issues such as where PEAR/Pyrus will be going in the next few years, what obstacles may be on the horizon, and how they’re going to get where they’re going.”

One of the panelists is Till Klampäckel who many of you know as one of the people who worked with HTMLCenter for many years. Till also just published a book (in German) about the database service CouchDB which you can purchase on Amazon.de.

The panel is free, will be streamed live and the panel will take questions via Twitter. If you are interested, you can register for the event here.

Please Stop Using cURL in WordPress Plugins

WordPress HTTP class usage

Unfortunately, I keep finding WordPress plugins that try to call cURL functions directly. Unfortunately, not only do these plugins fail to work if cURL isn’t installed, it throws a fatal PHP error in the process.

The problem with using cURL in WordPress plugins is that WordPress solved that problem more than 2 years ago by implementing the WP_Http class. WP_Http is a class included in the WordPress core that has multiple options. One of those options is cURL, but it gracefully reverts to other PHP functions if cURL isn’t available.

Basically, anything you can do with cURL can be done with the WP_Http class, and it will allow your plugin to be much more versatile and compatible with more server setups.

PHP: Stepping Through Arrays

I’ve posted a few articles about working with arrays in PHP over the past few years. I have posted information about adding and replacing elements in arrays; searching for items in arrays; and even a general post about handy array-related functions in PHP. I’m back again with a few more handy functions.

In PHP, you can obviously loop through arrays pretty easily by using a foreach() loop, but did you know you can actually step through arrays manually? PHP offers a handful of functions to do just that. Let’s take a look at those functions, and how you might be able to use them.

CodeIgniter 2.0 Released

Back in late 2008, I wrote about my first experience using the CodeIgniter framework. Since then, I’ve enjoyed using the framework with PHP — it reminds me of my days programming in ColdFusion.

Today EllisLab and the CodeIgniter team have released the 2.0.0 version of CodeIgniter.

Here’s a list of the main changes from 1.7.3 to 2.0.0:

  • Support for PHP 4 is gone, PHP 5.1 is now a requirement.
  • CSRF Protection built into the form helper
  • Drivers
  • Application Packages
  • Scaffolding, having been deprecated for a number of versions, has been removed.
  • Removed the deprecated Validation Class.
  • Plugins have been removed, in favor of Helpers.
  • Added routing overrides to the main index.php file, enabling the normal routing to be overridden on a per “index” file basis.
  • Added $route[‘404_override’] to allow 404 pages to be handled by controllers.
  • 50+ bugs fixed

They also note that this new 2.0.0 version has moved CodeIgniter into a, “much more community-oriented framework than it has been in the past.”

I can’t wait to play with the new version and try out some of the new features and functions.

Back Up Your MySQL Database with PHP

Obviously the ideal way to back up a MySQL database is to use mysqldump. Failing that, a lot of people will use PHPMyAdmin. Unfortunately, however, not everyone has command-line access to a server; and even fewer are able to execute mysqldump from a script. If PHPMyAdmin isn’t already installed, it can be difficult to get it installed and configured on a shared hosting account. Therefore, it’s sometimes necessary to use a PHP script to back up a MySQL database.

David Walsh has done a nice job of putting together a PHP script to backup your MySQL databases. Below is a copy of the code he provides in his blog article:

Calculating Future Dates with PHP

I recently received a request to set up a form that displays a recurring schedule of dates and times, allowing visitors to request one of those blocks of time as an appointment. The schedule would be the same every week, with numerous available blocks of time on specific days of each week.

I had two choices; I could either manually figure out each of the dates and then insert them into the database (either by-hand or with a script of some sort), which would require me to update the database to add new future dates rather frequently, or I could figure out a way to let PHP figure out the dates for me. I chose the latter, and I’ll show you how I did it after the jump.

Pages: