PHP Array

PHP Array Array in php is an ordered of map, containing value on the basis of key or you can say that array is collection of data in group under single variable. Suppose you want to store fruits name Example <?php $fruits = array(“Apple”, “Banana”, “pineapple”, “Orange”); ?> PHP Array Types There are 3 types […]


Loops in PHP

PHP Loops There are mostly 3 loops are available on programming languages. But in php ther are 4 loops available. While loop Do while loop For loop Foreach loop   1. While loop While loop start with the keyword while. While loop has a block, first it check the condition, if condition is true then […]


How to upload multiple images in PHP ?

How to upload multiple images in PHP ? Upload multiple images with validation of extension in php. And show all images of a folder to find total images.   <?php // Upload multiple files if($_FILES){ $error=array(); $extension=array(“jpeg”,”jpg”,”png”,”gif”); foreach($_FILES[“files”][“tmp_name”] as $key=>$tmp_name){ $file_name=$_FILES[“files”][“name”][$key]; $file_tmp=$_FILES[“files”][“tmp_name”][$key]; $ext=pathinfo($file_name,PATHINFO_EXTENSION); if(in_array($ext,$extension)){ if(!file_exists($file_name)){ move_uploaded_file($file_tmp=$_FILES[“files”][“tmp_name”][$key],$file_name); }else{ $filename=basename($file_name,$ext); $newFileName=$filename.time().”.”.$ext; move_uploaded_file($file_tmp=$_FILES[“files”][“tmp_name”][$key],$newFileName); } }else{ array_push($error,”$file_name, “); } […]


PHP 5 Switch Statement

PHP 5 switch Statement PHP switch statement is used for different actions on the base of different conditions. The switch statement is similar if statements on the same expression. When we have multiple options and we wants to select only, other words we can say that switch statement execute only one condition.   PHP switch […]


PHP 5 if…else…elseif Statements

PHP 5 if…else…elseif Statements PHP Conditional Statements Mostly in writing code, we want to perform different different actions for different conditions. We can use conditional statements. In PHP following conditional statements are available: if statement – executes some code if condition is true if…else statement – if condition true execute if otherwise execute else if […]


PHP Constants

PHP Constants or Constant in PHP   A constant is an identifier or name for a value. As the name, the value of variable cannot be change during the execution of the script. Constants are case-sensitive. Constant identifiers are always uppercase. Rule of a constant: Constant name starts with letter Constant name starts with underscore […]


PHP 5 Data Types

PHP Data Types A variable can store different types of data, and they can do different things. Following data types are support in PHP: String Integer Float (floating point numbers and also called double) Boolean Array Object NULL Resource PHP String Data Types A string is a collection of characters, like “Hello Friends!”. You can […]


PHP Variables

A variable is a name which contains values or information PHP variables: PHP variable starts with “$” sign. PHP variable name must start with a alpha letter. PHP variable name cannot start with a numeric value and underscore “_”. PHP variable name can only contain alpha, numeric and underscores value (A-z, 0-9, and _ ). […]