Home  • Programming • PHP

PHP Array for beginners

If you already know what is variable && how it is declare and also have basic knowledge about PHP so dear it is for you.Today I make clear about array.For experienced programmers it is important. What is Array? Array is a special variable where you can store more than one value at a time. Suppose you are the owner of a renowned company you want to store the names of all your employees in a PHP variable. How would you go about this? Yes, Array is the best way to help you now. Simple array example.... $employee_name=array("jhon","Michel","Juan"); How to declare an array? 1.declare variable. 2.= 3.write down array 4.() 5.in the string write down value one by one example...
$employee_name=array("jhon","Michel","Juan");
How many types of array? There are three types of array such as 1.Indexed array 2.Associative array 3.Multidimensional array. Indexed array
$array[key] = value;
1.The keys are the numbers and the values are the names of the employees Such as...
$employee_name[0]="Jhon";
2.You can declare Index array two types
$employee_name=array("jhon","Michel","Juan");
$employee_name[0]="jhon";
$employee_name[1]="Michel";
$employee_name[2]="Juan";
3.As you may have noticed from the above code example, an array's keys start from 0 and not 1 Associative array Just think if you want to store about all the employee's salary, what would you go for that yes to choose Associative array is a best smartness. Example..
$employee_salary["jhon"]="$300";

Comments 4


You should upload a php logo to media then use it in you php lesson. To use you media in you post just write like [media-230]
Here 230 is your media id say for example
It is recommended that each post should have at least a picture. Happy
Thank you sir...next time I will....
About Author
Most Monira Begum
Copyright © 2024. Powered by Intellect Software Ltd