PHP Lesson-4

Table of Contents

Introduction

In the previous lesson we learned the PHP tags open/close tags for a PHP code, and here in this lesson we will explore the PHP file and go inside those tags. When we use PHP we should know that every code we write and its defined as PHP Code will not be visible in the browser unless it contains HTML tags. What? What are you talking about? HTML tags in PHP? Yes, HTML tags can be placed in both, inside the PHP file and inside PHP code. In this lesson we will learn how to place HTML tags inside the PHP file, and in the next lessons we will go over how to place HTML tags inside PHP code.

Location

Where should I place the PHP code?
Well, PHP code can only written in a PHP file. Thus, the code can be anywhere in that file. PHP code works anywhere in the file as long as its in a PHP file and inside PHP open/close tags

Extension

What the extension of the PHP file?
The extension to PHP file is .php
Probably you saw a PHP file like this before: example.inc.php
That file still works as PHP file because it ends with .php Some people specify their files like this for organizing purpose.

File Content

Here we go. What kind of content can be in a PHP file?
The simple answer to this question is that most of web development program languages such as HTML, CSS, and JS can be in a PHP file. The most common language most of the time written inside a PHP file is HTML.
This is an example of HTML and PHP together in a PHP type file.

Case Sensitivity

Is PHP case-sensitive?
Yes and No. Means, there are cases in which PHP is case-sensitive and there are cases in which not. For example,
PHP is not case sensitive in these cases:
keywords (if, else, while, echo etc.), classes, functions, and user-defined functions.

PHP is case-sensitive in variables.

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart