PHP known as (Hypertext Preprocessor) is an open-source general-purpose scripting language mainly used for web development may be a static web page or dynamic webpage that could be embedded in HTML pages.
PHP is a Server-Side scripting language designed to be used for web development purposes in the environment that runs a scripting language termed as web server.
When we write a script in PHP it runs on a web server example it could be a XAMPP Server/WAMPP Server to generate dynamic HTML Web pages which in turn are sent to the client browser
Usually, PHP runs on various platforms (Linux, Unix, Mac OS, Windows), etc. and the servers compatible with PHP are (NGINX, Apache, XAMPP, WAMP).
Tutorial steps on how to download and install XAMPP Server Know More
It is usually used to provide interactive websites that interact with databases on the webserver.
How to connect PHP with MySQL in PHPMyAdmin using Xampp Server Know More
PHP basics for beginners – learn PHP language
Features of PHP
- Open Source – It is available free on internet to download viz. means not to pay any bucks.
- Simple – It is very simple and easy to use scripting language compared to others available.
- Faster – It is faster scripting language than JSP(Java Server Pages) and ASP(Active Server Pages)
- Interpreted – It is an interpreted language i.e. no need of compilation.
- Case Sensitive – PHP is a case sensitive scripting language which follows a particular rule while declaring variables and its use in the program(example, all keywords like echo, while, if-else, functions) except user-defined functions.
- Platform Independent – PHP code will be run on every platform , Linux, Unix, Mac OS X, Windows.
- Loosely typed language – PHP supports variable usage without declaring its datatype as it takes the same based on type of data value at execution time.
PHP Variables-
Variable is a naming convention we use to name that stands for a value. Variables are used for storing values such as numeric values, character values, memory addresses, or character strings so that they can be used in any part of the program.
Rules for declaring PHP Variable:
- A variable starts with the $ sign, followed by the name of the variable.
- A variable name must start with a letter or the underscore character.
- A variable name cannot start with a digit.
- A variable name can only contain alpha-numeric characters and underscores(A-z, 0-9, and _ )
- Variable names are case-sensitive ($age and $AGE are two different variables).
There are three different variable scopes in PHP:-
- global – Variable declared outside the function has Global scope and can only be accessed outside a function.
- local – variable declared within a function has a Local scope and can be accessed with in that function.
- static – It is used to declare variables in a function which keep their value after the function ends.
PHP Datatypes-
Variables that stores data could be of different types as per their need and PHP supports the following data types-
- String
- Integer
- Float
- Boolean
- Array
- NULL
PHP Comments-
In PHP, to comment a statement or code statement we use // or # before a statement in PHP that is not executed by the browser and not visible in the output of that particular program. And for a multi-line comment, you can use /* and */.
Are PHP and HTML the same?
PHP is a scripting language, whereas HTML is a markup language. HTML determines the general structure and content of a web page, while PHP provides dynamic content through scripts.
PHP is typically a server-side language, while HTML is client-side. PHP allows web developers to write dynamically written content into pages on the contrary HTML writes static content for creating static web pages.
PHP is an HTML-embedded server-side scripting language that means you can write PHP code in an HTML file using the scriptlet code<?php … ?>. Much of its syntax is borrowed from C, Java, and Perl.
The above article may help students to learn more about “PHP basics for beginners” who seek to learn PHP language to improve their development skills.
PHP basics for beginners
Practical Important Programs questions for Java Read More
Learn C Programming Basics & notes for beginners Read More