Skip to content

Commit

Permalink
Adding note about declaration first use after that for classes.
Browse files Browse the repository at this point in the history
#I had no time recently to add this but since a user complained on
#internals....
  • Loading branch information
faizshukri committed Jan 24, 2004
1 parent eff2006 commit 85de35e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.PHP4-TO-PHP5-THIN-CHANGES
Expand Up @@ -52,3 +52,19 @@
always make argc and argv available in the CLI version regardless of the always make argc and argv available in the CLI version regardless of the
variables_order setting. As in, the CLI version will now always populate variables_order setting. As in, the CLI version will now always populate
the global $argc and $argv variables. the global $argc and $argv variables.

8. Classes should be declared before used :
<?php
$test = new fubar();
$test->echo();

class fubar {
function echo() {
echo 'fubar';
}
}
?>
This script is perfectly valid and works in PHP4 but with PHP5 there
will be a fatal error like :
Fatal error: Class 'fubar' not found in ....
If there is defined function __autoload() it will be called.

0 comments on commit 85de35e

Please sign in to comment.