PHP Introduction

PHP is a server-side scripting language. This means PHP code runs on the server, and the result is sent to the client’s browser as plain HTML.

Tutorials dojo strip



What You Should Already Know

Before diving into PHP, you should be familiar with the following technologies:

  • HTML
  • CSS
  • JavaScript

If you need to learn these subjects first, check out the tutorials on our Home page.




What is PHP?

  • PHP stands for “PHP: Hypertext Preprocessor.”
  • PHP is a popular open-source scripting language.
  • PHP scripts run on the server.
  • PHP is free to download and use.
  • PHP is powerful enough to power the largest blogging system on the web (WordPress), robust enough to manage large social networks, and simple enough for beginners to learn as their first server-side language.




What is a PHP File?

  • PHP files can include text, HTML, CSS, JavaScript, and PHP code.
  • PHP code is executed on the server, and the outcome is delivered to the browser as plain HTML.
  • PHP files have the extension “.php”.



What Can PHP Do?

  • Generate Dynamic Content: PHP can create content that changes based on user interaction.
  • File Operations: PHP can create, open, read, write, delete, and close files on the server.
  • Form Data Collection: PHP can handle form data input from users.
  • Cookie Management: PHP can send and receive cookies.
  • Database Manipulation: PHP can add, delete, and modify data in your database.
  • User Authentication: PHP can control user access and permissions.
  • Data Encryption: PHP can encrypt data for added security.

With PHP, you aren’t limited to just HTML output. You can also generate images, PDF files, and other types of text, such as XHTML and XML.




Why PHP?

  • Cross-Platform Compatibility: PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.).
  • Server Compatibility: PHP works well with most servers currently in use (Apache, IIS, etc.).
  • Database Support: PHP supports a wide range of databases.
  • Cost-Effective: PHP is free to download from the official PHP website: php.net.
  • Ease of Learning: PHP is straightforward to learn and efficient for server-side scripting.




What’s New in PHP 7?

  • Speed Improvements: PHP 7 is significantly faster than the previous stable release (PHP 5.6).
  • Enhanced Error Handling: PHP 7 offers improved error handling capabilities.
  • Strict Type Declarations: PHP 7 supports stricter type declarations for function arguments.
  • New Operators: PHP 7 introduces new operators, such as the spaceship operator <=>.




Example Code Snippet

<!DOCTYPE html>
<html>
<body>

<?php
$car = "Toyota";
$motorcycle = "Yamaha";

echo "I own a " . $car . " car and a " . $motorcycle . " motorcycle.";
?>

</body>
</html>
Tutorials dojo strip
Scroll to Top