Category: 12. PHP
-
$ and $$ Variables
We know that PHP uses the convention of prefixing the variable names by the “$” symbol. PHP also has the provision of declaring dynamic variables by prefixing two dollar symbols ($$) to the name. A variable variable (or a dynamic variable) can be set and used dynamically. The declaration of a normal variable is like…
-
PHP var_dump() Function
One of the built-in functions in PHP is the var_dump() function. This function displays structured information such as type and the value of one or more expressions given as arguments to this function. This function returns all the public, private and protected properties of the objects in the output. The dump information about arrays and…
-
Echo/Print
In PHP, both echo and print statements are used to render the output either on the browser or the PHP console. Both of them are not functions but they are language constructs. Hence, parentheses should not be used with either of them. The “echo” Statement in PHP The echo statement is used with following syntax − The echo statement outputs one or more…
-
Variables
A variable in PHP is a named memory location that holds data belonging to one of the data types. Variables are assigned with the “=” operator, with the variable on the left hand side and the expression to be evaluated on the right. No Need to Specify the Type of a Variable PHP is a…
-
Comments
A comment in any computer program (such as a PHP program) is a certain explanatory text that is ignored by the language compiler/interpreter. Its purpose is to help the user understand the logic used in the program algorithm. Although placing comments in the code is not essential, it is a highly recommended practice. The comments…
-
Hello World
Conventionally, learners write a “Hello World” program as their first program when learning a new language or a framework. The objective is to verify if the software to be used has been installed correctly and is working as expected. To run a Hello World program in PHP, you should have installed the Apache server along…
-
Syntax
The syntax rules of PHP are very similar to C Language. PHP is a server side scripting language. A PHP code is stored as a text file with “.php” extension. A “.php” file is essentially a web page with one or more blocks of PHP code interspersed in the HTML script. However, it must be…
-
Features
PHP (Hypertext Preprocessor) is an open-source server-side scripting language primarily used for web development. PHP can be embedded into HTML code. PHP is mainly used for server-side scripting, which runs scripts on the web server and then forwards the HTML they process to the web browser on the client. This makes it possible for programmers…
-
History
PHP started out as a small open-source project that evolved gradually as more and more people found out how useful it was. Rasmus Lerdorf released the first version of PHP way back in 1994. At that time, PHP stood for Personal Home Page, as he used it to maintain his personal homepage. Later on, he…
-
Installation
You can start learning the basics of programming in PHP with the help of any of the online PHP compilers freely available on the Internet. This will help in getting acquainted with the features of PHP without installing it on your computer. Later on, install a full-fledged PHP environment on your local machine. One such…