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.5. Other Changes

Although the compatibility mode covers a few changes between PHP 4 and PHP 5, it does not fix all possible changes. For example, PHP 5 does not allow assigning to $this, which is a problem for a few PEAR classes (at the time of this writing). For example, the Pager/Pager.php file has the following code in its constructor:

$mode = (isset($options['mode']) ? $options['mode'] : 'Jumping');
$pager_class = 'Pager_' . ucfirst($mode);
$pager_classfile = 'Pager' . DIRECTORY_SEPARATOR . $mode . '.php';
require_once $pager_classfile;
$this = new $pager_class($options);

Another PHP 5 change not reverted by compatibility mode is the behavior of get_class().

13.5.1. Assigning to $this

When you use a line in PHP 4 that assigns a value ...

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