PHP Header

✦ PHP Introduction ✦

All programming languages ​​are divided into two parts, one is server side programming language and the other is client side programming language. Rasmus Lerdorf invented the PHP language in 1996 with the aim of making the website dynamic. PHP language is open source server side scripting language built on object oriented model. Just as the extension name of the file written in different programming language varies, similarly the extension name of the file written in PHP programming language is (.php).

The original extended name of PHP was Personal Home Page because in the initial stage this programming language was used for the purpose of making personal home pages dynamic, due to which this language was named PHP. There were many changes in this language from time to time, which were made public with the latest versions. PHP is currently known as Hypertext Preprocessor. PHP researchers made the latest version of PHP 8.2.3 public on 14 February 2023.

As we know, PHP is server side scripting language, i.e. the code written in PHP is executed on the server instead of the browser and only the result of that code is displayed in the browser. Whenever you create any type of web application with the help of PHP language, you need a server to see the result of the PHP code. You can also use your computer system as a server, for this you need to install third party software in your system which includes XAMPP, WAMP etc.

php code can be used anywhere with html language which is one of the main features of php. One thing to note is that whenever you are using php code with html code, you have to change the extension of that file from .html to .php otherwise that file will not execute on the browser. HTML language can be used in both PHP and HTML files, whereas PHP language can be used only in PHP files.

To use php code in web page file, we have to write <?php tag to start the php like html tag and then after using the php function, we have to close the php with ?> tag. Now let us take a simple example of PHP language and understand how we can write some text or words in our webpage using it...

✤ PHP echo Function ✤
<?php

echo "This is a PHP.";
echo 12345;

?>
✩ Result of above code ✩
This is a PHP.
12345

✦ Detailed Discussion ✦

Like JavaScript, PHP language also has many functions, one of which is echo function. With the help of echo function we can display any type of information on a web page. It means you can print any value in the webpage. The structure of this function is very simple in which first we have to start the echo function and then we have to write the value inside the double quote which has to be printed or displayed and finally close the function with semicolon.

PHP String

String in PHP is a sequence of characters that is used to serve various purposes like we have used the above string with echo function to write some words. String values ​​are written between 'single quotes' or "double quotes". Alphabetical characters in string values ​​are written between single quotes or double quotes but no quotes are required with numeric values. After writing the string value, it is necessary to close the echo function with a colon symbol.

String values ​​can also be written within parentheses, although this is not necessary. Multiple string values ​​can be used with the echo function which requires all string values ​​to be separated with comma symbols. Let's practice the echo function with multiple strings with an example...

✤ Use Multiple Strings ✤
<?php

echo "One"," Two"," Three";
echo ("Hello Friend's");

?>
✩ Result of above code ✩
One Two Three
Hello Friend's

We hope you have easily understood the Echo function. Detailed information about all function of PHP is available on this platform.

X Help by donating Donet
Dark Mode Donet