O'Reilly logo

PHP 5 Power Programming by Derick Rethans, Stig Sæther Bakken, Andi Gutmans

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

13.8. Changes in Functions

Some minor changes in functions break backward compatibility. There are countless other additions to functions and additional functions, but these do not affect compatibility between PHP 4 and PHP 5.

13.8.1. array_merge()

This function no longer accepts a non-array parameter as one of its arguments. In PHP 4, it was perfectly valid to use scalar types, like an integer or string (but not a variable representing “null”), as parameter. These types are happily included as an element in the resulting array. PHP 5 no longer supports this. If you use a scalar type, PHP 5 issues an error of type E_WARNING and return an empty array. You can see this behavior by comparing the output of this script from PHP 4 and PHP 5:

 <?php ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required