Qortora · Search · Indexed page

www.tutorialspoint.comFetched 2026-08-17T12:46:21Z

PHP Tutorial

PHP is an open-source general purpose scripting language, widely used for website development. It is developed by Rasmus Lerdorf in 1994. PHP is a a recursive acronym for 'PHP: Hypertext Preprocessor'.

Open original source · Full cached text

PHP Tutorial Home Whiteboard Practice Code Graphing Calculator Online Compilers Articles Tools Categories Explore Categories Find the perfect tutorial for your learning journey Python TechnologiesDatabasesComputer ProgrammingWeb DevelopmentJava TechnologiesComputer ScienceMobile DevelopmentBig Data & AnalyticsMicrosoft TechnologiesDevOpsLatest TechnologiesMachine LearningDigital MarketingSoftware QualityManagement Tutorials View All Categories Tutorials Courses Jobs Login PHP - Home PHP - Roadmap PHP - Introduction PHP - Installation PHP - History PHP - Features PHP - Syntax PHP - Hello World PHP - Comments PHP - Variables PHP - Echo/Print PHP - var_dump PHP - $ and $$ Variables PHP - Constants PHP - Magic Constants PHP - Data Types PHP - Type Casting PHP - Type Juggling PHP - Strings PHP - Boolean PHP - Integers PHP - Files & I/O PHP - Maths Functions PHP - Heredoc & Nowdoc PHP - Compound Types PHP - File Include PHP - Date & Time PHP - Scalar Type Declarations PHP - Return Type Declarations PHP - Operators PHP - Arithmetic Operators PHP - Comparison Operators PHP - Logical Operators PHP - Assignment Operators PHP - String Operators PHP - Array Operators PHP - Conditional Operators PHP - Spread Operator PHP - Null Coalescing Operator PHP - Spaceship Operator PHP Control Statements PHP - Decision Making PHP - If…Else Statement PHP - Switch Statement PHP - Loop Types PHP - For Loop PHP - Foreach Loop PHP - While Loop PHP - Do…While Loop PHP - Break Statement PHP - Continue Statement PHP Arrays PHP - Arrays PHP - Indexed Array PHP - Associative Array PHP - Multidimensional Array PHP - Array Functions PHP - Constant Arrays PHP Functions PHP - Functions PHP - Function Parameters PHP - Call by value PHP - Call by Reference PHP - Default Arguments PHP - Named Arguments PHP - Variable Arguments PHP - Returning Values PHP - Passing Functions PHP - Recursive Functions PHP - Type Hints PHP - Variable Scope PHP - Strict Typing PHP - Anonymous Functions PHP - Arrow Functions PHP - Variable Functions PHP - Local Variables PHP - Global Variables PHP Superglobals PHP - Superglobals PHP - $GLOBALS PHP - $_SERVER PHP - $_REQUEST PHP - $_POST PHP - $_GET PHP - $_FILES PHP - $_ENV PHP - $_COOKIE PHP - $_SESSION PHP File Handling PHP - File Handling PHP - Open File PHP - Read File PHP - Write File PHP - File Existence PHP - Download File PHP - Copy File PHP - Append File PHP - Delete File PHP - Handle CSV File PHP - File Permissions PHP - Create Directory PHP - Listing Files Object Oriented PHP PHP - Object Oriented Programming PHP - Classes and Objects PHP - Constructor and Destructor PHP - Access Modifiers PHP - Inheritance PHP - Class Constants PHP - Abstract Classes PHP - Interfaces PHP - Traits PHP - Static Methods PHP - Static Properties PHP - Namespaces PHP - Object Iteration PHP - Encapsulation PHP - Final Keyword PHP - Overloading PHP - Cloning Objects PHP - Anonymous Classes PHP Web Development PHP - Web Concepts PHP - Form Handling PHP - Form Validation PHP - Form Email/URL PHP - Complete Form PHP - File Inclusion PHP - GET & POST PHP - File Uploading PHP - Cookies PHP - Sessions PHP - Session Options PHP - Sending Emails PHP - Sanitize Input PHP - Post-Redirect-Get (PRG) PHP - Flash Messages PHP AJAX PHP - AJAX Introduction PHP - AJAX Search PHP - AJAX XML Parser PHP - AJAX Auto Complete Search PHP - AJAX RSS Feed Example PHP XML PHP - XML Introduction PHP - Simple XML Parser PHP - SAX Parser Example PHP - DOM Parser Example PHP Login Example PHP - Login Example PHP - Facebook Login PHP - Paypal Integration PHP - MySQL Login PHP Advanced PHP - MySQL PHP.INI File Configuration PHP - Array Destructuring PHP - Coding Standard PHP - Regular Expression PHP - Error Handling PHP - Try…Catch PHP - Bugs Debugging PHP - For C Developers PHP - For PERL Developers PHP - Frameworks PHP - Core PHP vs Frame Works PHP - Design Patterns PHP - Filters PHP - JSON PHP - Exceptions PHP - Special Types PHP - Hashing PHP - Encryption PHP - is_null() Function PHP - System Calls PHP - HTTP Authentication PHP - Swapping Variables PHP - Closure::call() PHP - Filtered unserialize() PHP - IntlChar PHP - CSPRNG PHP - Expectations PHP - Use Statement PHP - Integer Division PHP - Deprecated Features PHP - Removed Extensions & SAPIs PHP - PEAR PHP - CSRF PHP - FastCGI Process PHP - PDO Extension PHP - Built-In Functions PHP Useful Resources PHP - Cheatsheet PHP - Questions & Answers PHP - Quick Guide PHP - Useful Resources PHP - Discussion PHP - Online Compiler Selected Reading UPSC IAS Exams Notes Developer's Best Practices Questions and Answers Online Resume Builder HR Interview Questions Computer Glossary Who is Who Home Php PHP Tutorial Table of content PHP Tutorial Why Learn PHP? PHP Characteristics Advantages of Using PHP Popular PHP Frameworks Hello World Using PHP Online PHP Compiler PHP Audience PHP Prerequisites Download PHP Frequently Asked Questions about PHP Job Search PDF Version Quick Guide Resources Discussion What is PHP? PHP is an open-source general purpose scripting language, widely used for website development. It is developed by Rasmus Lerdorf in 1994. PHP is a a recursive acronym for 'PHP: Hypertext Preprocessor'. PHP is the world's most popular server-side programming language. Its latest version PHP 8.4.3, released on January 16th, 2025. PHP is a server-side scripting language that is embedded in HTML. PHP is a cross-platform language, capable of running on all major operating system platforms and with most of the web server programs such as Apache, IIS, lighttpd and nginx. A large number of reusable classes and libraries are available on PEAR and Composer. PEAR (PHP Extension and Application Repository) is a distribution system for reusable PHP libraries or classes. Composer is a dependency management tool in PHP. Why Learn PHP? PHP one of the most preferred languages for creating interactive websites and web applications. PHP scripts can be easily embedded into HTML. With PHP, you can build Web Pages and Web-Based Applications Content Management Systems, and E-commerce Applications etc. A number of PHP based web frameworks have been developed to speed-up the web application development. The examples are WordPress, Laravel, Symfony etc. PHP Characteristics Below are the main characteristics which make PHP a very good choice for web development − PHP is Easy to Learn Open-Source & Free Cross-Platform Compatibility Server-Side Scripting Embedded in HTML Database Connectivity Object-Oriented & Procedural Support Large Standard Library Supports Various Protocols Framework Support Advantages of Using PHP PHP is a MUST for students and working professionals to become great Software Engineers, especially when they are working in Web Development Domain. Some of the most notable advantages of using PHP are listed below − PHP is a multi-paradigm language that supports imperative, functional, object-oriented, and procedural programming methodologies. PHP is a server-side scripting language that is embedded in HTML. It is used to manage dynamic content, databases, session tracking, even build entire e-commerce sites. PHP is integrated with a number of popular databases including MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server. PHP is pleasingly zippy in its execution, especially when compiled as an Apache module on the Unix side. The MySQL server, once started, executes even very complex queries with huge result sets in record-setting time. PHP supports a number of protocols such as POP3, IMAP, and LDAP. PHP supports distributed object architectures (COM and CORBA), which makes n-tier development possible. PHP is forgiving: PHP language tries to be as forgiving as possible. PHP has a familiar C-like syntax. There are five important characteristics of PHP that make its practical nature possible: Simplicity, Efficiency, Security, Flexibility, and Familiarity. Popular PHP Frameworks Here are some of the most popular PHP frameworks − Laravel: Used for building big and secure web applications. CodeIgniter: Very fast and lightweight framework. Good for small projects. Symfony: Used for large and complex applications. CakePHP: Good for making fast and secure websites. FuelPHP: Secure and flexible framework for web development. YII: Best for developing modern Web Applications. Phalcon: It is a PHP full-stack framework. Pixie: Full-stack PHP framework and follows HMVC architecture. Slim: Lightweight micro-framework used for creating RESTful APIs and services. Hello World Using PHP Just to give you a little excitement about PHP, I'm going to give you a small conventional PHP Hello World program. You can try it using the Edit & Run button. <?php echo "Hello, World!"; ?> Online PHP Compiler Our PHP tutorial provides various examples to explain different concepts. We have provided an online compiler, where you can write, save, run, and share your programs directly from your browser without setting up any development environment. Practice PHP here: Online PHP compiler. Audience This PHP tutorial is designed for programmers who are completely unaware of PHP concepts but have a basic understanding on computer programming. Prerequisites Before proceeding with this tutorial, all that you need to have is a basic understanding of computer programming. Knowledge of HTML, CSS, JavaScript, and databases will be an added advantage. Download PHP You can download PHP's latest version from its official websites. Here is the link to open the PHP download page:PHP Downloads & Installation Frequently Asked Questions about PHP There are some very Frequently Asked Questions(FAQ) about PHP, this section tries to answer them briefly. Do I Need Prior Programming Experience to Learn PHP? PHP is that's relatively easy to learn, even for beginners with little or no programming experience. To learn PHP, one needs to only have a basic understanding of computer programming, Internet, database, and HTML. However, prior knowledge of any one programming knowledge is an additional advantage. After learning the core PHP, you can the become proficient in any PHP web framework suitable for the development of applications, such as WordPress, Laravel etc. Is PHP Free to Use? As PHP is open-source, it is free to use. You can also freely distribute the applications built with PHP. The PHP license under which the PHP scripting language is released, implies that, The PHP code can be redistributed in source or binary form. It also means its use and its many libraries and frameworks can be used for both commercial and private use. What are the Applications of PHP? PHP is a server-side scripting language, optimized especially for building dynamic web applications. Developers use PHP to develop applications like content management systems, blogging applications, E-commerce applications, REST APIs etc. A number of PHP frameworks have been developed that are suitable for building applications of a specific type. For example, WordPress is used for building business websites and blogs. Similarly, Laravel is used in E-commerce platforms, Social networking apps, and CRM systems. How Do I Install PHP? To run a PHP application, you need a server, a database server, and a PHP parser software. The most preferred combination is an Apache server, MySQL database, and a PHP module. While one can install all these components individually and configure them, the easiest way is to install pre-compiled binaries bundled together. Examples are XAMPP, WAMP and LAMP. XAMPP is a cross-platform and open-source web server stack package developed by Apache Friends. It consists of the Apache HTTP Server, MariaDB database (an open-source fork of MySQL), and interpreters fo PHP and Perl. The XAMPP software Cn be downloaded from https://www.apachefriends.org/download.html. What Tools and Technologies Work Well with PHP? PHP is a server-side scripting language, that is optimized for building dynamic web applications. One or more blocks of PHP script …