Backward Incompatible Changes

Although most existing PHP 4 code should work without changes, you should pay attention to the following backward incompatible changes:

Example B-1. strrpos() and strripos() now use the entire string as a needle

<?php
var_dump
(strrpos('ABCDEF','DEF')); //int(3)

var_dump(strrpos('ABCDEF','DAF')); //bool(false)
?>

Example B-2. An object with no properties is no longer considered "empty"

<?php
class test { }
$t = new test();

var_dump(empty($t)); // echo bool(false)

if (!$t) {
    
// Will be executed
}
?>

The following example was valid in PHP 4, although it will produce a fatal error in PHP 5.

Example B-3. Classes must be declared before used

<?php
$test
= new fubar();
$test->barfu();

class
fubar {
    function
barfu() {
        echo
'fubar';
    }
}
?>


Sites of interest: Web Hosting : Reseller Hosting : Website Hosting : HTML Editor : Web Design Templates : Free Web Hosting : ASP code examples : PHP & MySQL Code Examples
  Copyright © 2004 Evrsoft Developer Network. Privacy policy - Link to Us

Contact Evrsoft