PHP arrays | 9 Demos of Simple and Usage with HTML Elements
The array is a type of variable used to store multiple values in PHP programs.
The array is a type of variable used to store multiple values in PHP programs.
Purpose of if..else in PHP The if else is a decision-making statement in PHP and many other programming languages. The PHP if statement will execute one block of code between two or many options – so taking the decision based at certain given criteria. Syntax of PHP if statement If there are only two options … Read more
Purpose of echo and print statements The echo and print statements are used to display the strings in PHP programs. While both, the echo and PHP print statements, are not functions but are language constructs. That means you do not need to use parenthesis like in the normal functions. Keep reading to learn how to … Read more
Purpose of empty function The PHP empty function is used to determine if a variable is empty or not. It will return True if the given variable is empty and false if it exists or a non-zero or more than zero characters etc. I will explain further in the later part of this tutorial, first … Read more
Purpose of isset in PHP The isset function is used to check if a variable is set or not. That means it determines if a variable is assigned a value and is not null. Also, the isset PHP function checks if the given variable is not unset by using the unset function. Syntax of using the isset … Read more
Purpose of explode method The explode method, as the function name suggests, is used to split a string to the given number of substrings in PHP. It returns an array of broken substrings that you may assign to an array variable. You may find the details of the explode method in the last part of this … Read more
Syntax of PHP foreach loop The foreach loop is used to iterate through array elements in PHP. This is how you can use the foreach loop: foreach($array_name as $value){ //Statement to execute } And you can use foreach in this way as well: foreach($array_name as $key =>$value){ //Statement to execute Both of these methods of using … Read more
Syntax of using the Switch case The switch case is among the decision-making statements in PHP. Before explaining the purpose and difference between the other decision-making statement (if..else) in the later part, let us first look at the syntax and live examples of using this. Following is the general way to use PHP switch case … Read more