PHP if..else and elseif: Explained with visual examples

PHP if else email

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

Categories PHP

PHP echo and print Statements

PHP echo variables

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

Categories PHP

PHP empty Function

PHP empty featured

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

Categories PHP

PHP isset and unset Functions

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

Categories PHP

PHP explode Method

PHP explode

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

Categories PHP

PHP foreach Loop | 2 Ways to Use it

PHP foreach associative array

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

Categories PHP

PHP Switch Case Statement

PHP Swtich Case

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

Categories PHP