PHP Handbuch
Zurück | Anhang D. Migration von PHP/FI 2.0 zu PHP 3.0 | Weiter

# Function `TRUE`/false return values

Most internal functions have been rewritten so they return `TRUE` when successful and `FALSE` when failing, as opposed to 0 and -1 in PHP/FI 2.0, respectively. The new behaviour allows for more logical code, like $fp = fopen("/your/file") or fail("darn!");. Because PHP/FI 2.0 had no clear rules for what functions should return when they failed, most such scripts will probably have to be checked manually after using the 2.0 to 3.0 convertor.

Beispiel D-9. Migration von 2.0: Rückgabewerte, alter Code

`$fp = fopen($file, "r"); if ($fp == -1); echo("Konnte $file zum lesen nicht &ouml;ffnen&lt;br&gt;\n"); endif;`

Beispiel D-10. Migration von 2.0: Rückgabewerte, neuer Code

`$fp = @fopen($file, "r") or print("Konnte $file zum lesen nicht &ouml;ffnen<br>;\n");`

Zurück | Zum Anfang | Weiter
Short-circuited boolean evaluation | Nach oben | Andere Inkompatibilitäten