Category: PHP Tutorial

python tutorials and learn python

Created with Sketch.

PHP PDO

PHP PDO PHP PDO is a database access layer that provides a uniform interface for working with multiple databases. PDO simplifies the common database operations including: Creating database connections Executing queries using prepared statements Calling stored procedures Performing transactions And handling errors PDO allows you to work with any database that has a PDO driver…
Read more

PHP Anonymous Class

PHP Anonymous Class Summary: in this tutorial, you’ll learn how about the PHP anonymous class and how to define anonymous classes. Introduction to the PHP anonymous classes So far, you have learned how to define a new class with a name. For example: <?php class MyClass { // … } Code language: PHP (php) The…
Read more

PHP property_exists

PHP property_exists Summary: in this tutorial, you’ll learn how to use the property_exists() function to check if the object or class has a property. Introduction to the PHP property_exists function The property_exists() function returns true if an object or a class has a property. Otherwise, it returns false. Here’s the syntax of the property_exists() method:…
Read more

PHP method_exists

PHP method_exists Summary: in this tutorial, you’ll learn how to use the PHP method_exists() function to check if a class or an object of a class has a specified method. Introduction to the PHP method_exists function The method_exists() function returns true if an object or a class has a specified method. Otherwise, it returns false.…
Read more

PHP class_exists

PHP class_exists Summary: in this tutorial, you’ll learn how to use the PHP class_exists() function to check if a class exists or not. Introduction to the PHP class_exists() function The class_exists() function accepts a class name and returns true if the class exists or false otherwise. class_exists(string $class, bool $autoload = true): bool Code language:…
Read more

PHP Set Exception Handler

PHP Set Exception Handler Summary: in this tutorial, you will learn how to set an exception handler using the PHP set_exception_handler() function. Introduction to the PHP set_exception_handler function In practice, it’s very difficult to catch every possible exception. If an exception is uncaught, you’ll see the exception message on the page. PHP allows you to…
Read more

PHP throw Exception

PHP throw Exception Summary: in this tutorial, you will learn about the Exception class in detail and how to throw a new exception in PHP. Introduction to the Exception class When encountering a situation from which you cannot recover, you can throw an exception. An exception is an instance of the Exception class. Like other…
Read more

PHP try…catch…finally

PHP try…catch…finally Summary: in this tutorial, you’ll learn how to use the PHP try…catch…finally statement to handle exceptions and clean up the resources. Introduction to the PHP try…catch…finally statement The try…catch statement allows you to handle exceptions. When an exception occurs in the try block, the execution jumps to the catch block. In the catch…
Read more

PHP try…catch

PHP try…catch Summary: in this tutorial, you will learn how to use the PHP try…catch statement to handle exceptions. Introduction to the PHP try…catch statement In programming, unexpected errors are called exceptions. Exceptions can be attempting to read a file that doesn’t exist or connecting to the database server that is currently down. Instead of…
Read more

PHP Composer Autoload

PHP Composer Autoload Summary: in this tutorial, you’ll learn how to use Composer to autoload PHP classes from files using PSR-4 standard. Loading classes using the require_once construct First, create the following directory structure with files: . ├── app │ ├── bootstrap.php │ └── models │ └── User.php └── index.php Code language: PHP (php) The…
Read more