Tag

php 5

Browsing

In PHP 4 error handling in functions and methods was returned by the return command. Let´s say we would like to connect to a database via MySQLi inside a method or function. If the connection fails an error message and the error code should be displayed. In PHP 4 the error handling would have looked like this: function connect_to_mysql() {$mysqli = @new mysqli(‘localhost’, ‘username’, ‘password’, ‘db_name’); if ($mysqli->connect_errno) { return false;} return true;} To find…