Jul
17

End for PHP4

Uncategorized

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Today it is exactly three years ago since PHP 5 has been released. In those three years it has seen many improvements over PHP 4. PHP 5 is fast, stable & production-ready and as PHP 6 is on the way, PHP 4 will be discontinued.

The PHP development team hereby announces that support for PHP 4 will continue until the end of this year only. After 2007-12-31 there will be no more releases of PHP 4.4. We will continue to make critical security fixes available on a case-by-case basis until 2008-08-08. Please use the rest of this year to make your application suitable to run on PHP 5.

~ taken from PHP.net first page

Well it’s about time. Now if only my webhosts would changeover to PHP5 :( For documentation on migration for PHP 4 to PHP 5, we would like to point you to our migration guide. There is additional information available in the PHP 5.0 to PHP 5.1 and PHP 5.1 to PHP 5.2 migration guides as well.

Jul
15

Useful PHP libraries

PHP

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

I’m playing with the idea of writing my own custom CMS for a future project.
Actually I’ve also chosen similiar libraries for one of my major CMS project 5 years ago!! Since the tools are still used today, they have stood the test of time.

To build a nice supporting libraries, I’ve chosen the following:

Smarty templating engine(last update:March 7th, 2007)
One of the best templating system in PHP in my opinion. Basically it’s a good idea to separate PHP code from html. For newbies, you may need to invest a little time to get used to the idea but it’s worth it.
Also, the caching system is pretty nice as it caches common PHP generated files into static HTML making retrieval and display on browsers many times faster and less taxing on the webserver. All good things to have!

ADODB (last update:May 20, 2007)
Data Abstraction library. Basically it replaces all the common database query commands with it’s own. This means if an app has already been written to support MySQL, changing it to another DB sysytem such as MSSQL only requires a one or two line change in the configuration file.

Scriptaculous(last update: May 25th, 2007)
Ajax library. To have those nice AJAX dynamic pages. Update portion of pages without entire page refreshes. Just so essential if you want your app to have the Web 2.0 feel :)

I really want to use CakePHP too as a framework to really cut development time down but I found it hard to learn. I’m still persevering and trying to pick it up by next month but in the meantime, I’ll continue with the above libraries.

Powered by ScribeFire.

Jul
13

Date validate

PHP

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

My friend Shaun asked me if PHP can do a date validation and I was sure it could with all the built-in date function. So no reason to write a custom date validation function from scratch.

A quick google search and check on php.net shows that you can use PHP’s checkdate function to do the validation.

Here’s an example:-


Here’s the full source code:


<form method=post action=<? $_SERVER[’PHP_SELF’] ?>>
    Enter date<input type=text value=” name=dt>
    <input type=submit>
</form>
<?

  if (isset($_POST[’dt’])) {
      if ($_POST[’dt’]==”) {
           echo  “Please enter a date”;
           die();
      }
      validate();
  }

  function validate() {
        $dt=$_POST[’dt’];
        //$dt=”02/28/2007″;
        $arr=split(”/”,$dt); // splitting the array
        $mm=$arr[1]; // first element of the array is month
        $dd=$arr[0]; // second element is date
        $yy=$arr[2]; // third element is year
        If(!checkdate($mm,$dd,$yy)){
        echo “invalid date”;
        } else {
        echo “Entry date is correct”;
      }
  }
?>