Team LiB
Previous Section Next Section

New Behavior of Functions

Some well-known PHP functions changed their behavior so that code that used to work might start to produce strange results. At http://www.php.net/manual/en/migration5.incompatible.php you find a complete list, but the two most important changes are the following.

First, array_merge() now accepts only arrays as parameters, not scalar values such as strings. If you try to pass a scalar value to array_merge(), a warning (E_WARNING) is issued. The return value of such a call is NULL. To add scalar elements to an array, array_push() is now the recommended way.

Second, strrpos() and the version that is not case sensitive, strripos(), now searches the complete second parameter ("needle") in the first parameter ("haystack"). Previously, only the first character of the needle was searched for. The functions strpos() and stripos() have always searched for the full needle.

    Team LiB
    Previous Section Next Section