What are some common pitfalls when migrating PHP scripts from PHP4 to PHP5?

One common pitfall when migrating PHP scripts from PHP4 to PHP5 is the use of deprecated functions, such as "ereg" which has been replaced by "preg_match". To solve this issue, you should update your code to use the newer, supported functions.

// PHP4 code using ereg
if (ereg('pattern', $string)) {
    // do something
}

// PHP5 code using preg_match
if (preg_match('/pattern/', $string)) {
    // do something
}