Tutorials Logic, IN +91 8092939553 info@tutorialslogic.com
Navigation
Home About Us Contact Us Blogs FAQs
Tutorials
All Tutorials
Services
Academic Projects Resume Writing Interview Questions Website Development
Compiler Tutorials

Introduction

PHP

PHP is a server-side scripting language like ASP and JSP that can do all sorts of things: evaluate form data sent from a browser, build custom web content to serve the browser, talk to a database, and even send and receive cookies. Basically PHP designed for web development but also used as a general-purpose programming language. PHP scripts are executed on the server. PHP supports many databases like- MySql, Oracle, Sybase, Solid, PostgreSql, Generic ODBC... etc. PHP is open source software. PHP is free to download and use.

PHP File

  • PHP file can contain plain text, HTML tags, internal and external CSS, PHP script and Java-script... etc.
  • After PHP files are processed, their output returned to the browser as pure plain HTML.
  • PHP filename usually have the file extension of .php, .php3, .phtml.
  • PHP file can contain SQL query too.

Why PHP

  • PHP runs perfectly on different operating system like- Windows, Linux, Unix... etc.
  • PHP is compatible with almost all web serversused today like- Apache, IIS... etc.
  • PHP is free to download from the official website of PHP www.php.net.
  • PHP is very easy to learn and runs very efficiently on any compatible web servers.

Where to Start

To start with PHP, you can:-

  • Install Apache or IIS as own server, install PHP, and My-sql.
  • Find a web hosting plan with PHP and My-sql support.

PHP Setup

Your First PHP Program

PHP code is embedded in HTML using <?php ... ?> tags. The server processes the PHP and sends plain HTML to the browser.

Hello World in PHP
<?php
// Single-line comment
/* Multi-line comment */

// Variables start with $
$name = "Tutorials Logic";
$version = 8.2;
$isActive = true;

// Output
echo "Hello, World!<br>";
echo "Welcome to $name<br>";

// String interpolation
echo "PHP version: {$version}<br>";

// print_r for arrays/objects
$languages = ["PHP", "JavaScript", "Python"];
print_r($languages);

// var_dump shows type + value
var_dump($isActive);  // bool(true)
?>

PHP Versions - Key Milestones

VersionYearKey Features
PHP 5.62014Variadic functions, constant expressions
PHP 7.020152x faster, scalar type hints, null coalescing ??
PHP 7.42019Typed properties, arrow functions, spread operator
PHP 8.02020JIT compiler, named arguments, match expression, union types
PHP 8.12021Enums, fibers, readonly properties, intersection types
PHP 8.22022Readonly classes, DNF types, deprecated dynamic properties
PHP 8.32023Typed class constants, json_validate(), deep cloning
Key Takeaways
  • PHP is a server-side language - code runs on the server and sends HTML to the browser.
  • PHP files use the .php extension and can mix HTML and PHP code.
  • Variables in PHP start with a $ sign and are dynamically typed.
  • PHP 8.x introduced major performance improvements via the JIT compiler - always use PHP 8+ for new projects.
  • PHP powers over 75% of websites with a known server-side language, including WordPress, Laravel, and Drupal.
  • Use echo or print to output content; var_dump() and print_r() for debugging.

Ready to Level Up Your Skills?

Explore 500+ free tutorials across 20+ languages and frameworks.