


Vergleich der Ausnahme- und Fehlerbehandlung in PHP7 mit früheren Versionen
Vergleich der Ausnahme- und Fehlerbehandlung in PHP7mit früheren Versionen
Beginnen wir mit dem Code
ECHO PHP_VERSION.PHP_EOL; function add (int $left,int $right){ return $left+$right; } try { echo add('left', 'right'); } catch (Exception $e) { // Handle exception } catch (Error $e) { // Clearly a different type of object // Log error and end gracefully var_dump($e->getMessage()); } echo PHP_EOL."helloword".PHP_EOL;
PHP v5.6.1-Ergebnisse
5.6.1 PHP Catchable fatal error: Argument 1 passed to add() must be an instance of int, string given, called in C:\usertb\shareubuntu\Workerman\fortest.php on line 8 and defined in C:\usertb\shareubuntu\Workerman\fortest.php on line 3 Catchable fatal error: Argument 1 passed to add() must be an instance of int, string given, called in C:\usertb\shareubuntu\Workerman\fortest.php on line 8 and defined in C:\usertb\shareubuntu\Workerman\fortest.php on line 3 [Finished in 0.0s]
PHP v7.0.15-Ergebnisse
7.0.15-0ubuntu0.16.04.4 string(131) "Argument 1 passed to add() must be of the type integer, string given, called in /home/tb/win10share/Workerman/fortest.php on line 8" helloword
Unterschied
Letzteres kann schwerwiegende Fehler erfassen und Halloword normal ausgeben
Das obige ist der detaillierte Inhalt vonVergleich der Ausnahme- und Fehlerbehandlung in PHP7 mit früheren Versionen. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Heiße KI -Werkzeuge

Undresser.AI Undress
KI-gestützte App zum Erstellen realistischer Aktfotos

AI Clothes Remover
Online-KI-Tool zum Entfernen von Kleidung aus Fotos.

Undress AI Tool
Ausziehbilder kostenlos

Clothoff.io
KI-Kleiderentferner

AI Hentai Generator
Erstellen Sie kostenlos Ai Hentai.

Heißer Artikel

Heiße Werkzeuge

SAP NetWeaver Server-Adapter für Eclipse
Integrieren Sie Eclipse mit dem SAP NetWeaver-Anwendungsserver.

Herunterladen der Mac-Version des Atom-Editors
Der beliebteste Open-Source-Editor

ZendStudio 13.5.1 Mac
Leistungsstarke integrierte PHP-Entwicklungsumgebung

VSCode Windows 64-Bit-Download
Ein kostenloser und leistungsstarker IDE-Editor von Microsoft

Senden Sie Studio 13.0.1
Leistungsstarke integrierte PHP-Entwicklungsumgebung