Code Conquest

  • Home
  • What is Coding?
  • Tutorials
  • Training
  • Reviews
  • Knowledge Center
  • Versus
  • Blog
You are here: Home / Free Code Tutorials / Free PHP Tutorial

Free PHP Tutorial

PHPPHP is a scripting language that has the ability to output HTML. Instead of manually writing HTML files, you can program PHP to automatically generate them for you.

Did you know that every page you see on this website is generated from a single PHP script? This means that when a new page is added, there’s no need to manually create an HTML file. The PHP script generates it.

PHP and HTML

PHP scripts are embedded inside HTML files. The start of a PHP script is indicated by <?php and the end is indicated by ?>. When a script is run, it’s replaced in the HTML by its output. For example, the following PHP script outputs the text ‘Hello’:

<b><?php echo 'Hello'; ?></b>

The above PHP script will be replaced by its output. So the resulting HTML is this:

<b>Hello</b>

There can be an unlimited number of PHP scripts in an HTML file, and they can be placed anywhere inside the file.

However, HTML files that contain PHP use the file extension .php, rather than the usual .html. This is so that the PHP interpreters on web servers know that the file contains PHP code to be executed.

PHP Include

One of the useful features of PHP is its ability to include files inside other files.

Many websites use the same header on every page of their site. With PHP, they can write their header in a separate HTML file called header.html, and have PHP ‘include’ the contents of this file on every other page. They do this by writing the following code where they want the header to go:

<?php include('header.html'); ?>

This way, when they want to edit their header, they only need to edit their header.html file once and the changes are made on every page.

Learn More PHP

PHP is a very powerful language with many capabilities, most of which are beyond the scope of this tutorial. But luckily for you, there is more extensive PHP training available if you want to go further with PHP.

You can get online PHP training from providers like Treehouse. PHP is also covered by some good books such as PHP and MySQL for Dynamic Websites, and PHP and MySQL Web Development.

See all PHP training recommendations…



Disclosure of Material Connection: Some of the links in the post above are “affiliate links.” This means if you click on the link and purchase the item, I will receive an affiliate commission. Regardless, I only recommend products or services I use personally and believe will add value to my readers.

Popular Series

  • What is Coding?
  • How to Make Your First Website
  • Understanding Hex Color Codes
  • How to Become a Coder in 6 Months: a Step-by-Step Action Plan
  • How to Start a Coding Project

Get Our Newsletter

Enter your email address and we'll notify you whenever we add something new to the site.

Popular Blog Posts

  • The 50 Best Websites to Learn Python
  • The 50 Best Websites to Learn JavaScript
  • The 50 Best Websites to Learn PHP
  • Want to Switch Careers? Coding May Be the Perfect Solution!
  • 9 of the Hottest Tech Skills Hiring Managers Look for on LinkedIn

Latest Blog Posts

  • Effective Strategies For Debugging Code
  • Effective Time Management Tips for Programmers
  • Code Documentation: Tools and Techniques
  • Is Data Analytics Hard to Learn?
  • Comparing Data Science vs Computer Science

Explore Code Conquest

  • What is Coding?
  • Free Code Tutorials
  • Coding Training Recommendations
  • Coding Training Reviews
  • Knowledge Center
  • Cheat Sheets
  • Coding Quizzes
  • Versus

Deals, Discounts and Coupons

Deals

Code Conquest

  • Home
  • About
  • Privacy Policy
  • Contact Us
  • Terms of Use
  • Write for Us
  • Featured Review

Copyright © 2025 Code Conquest · About · Terms · Privacy · Contact Us · Write For Us