What is array in PHP | PHP Tutorial for Beginners to Advance Full Course | part 14
What is Array :
array is a data structure that stores one or more similar type of values in a single value.
Example
if you want to store 50 numbers then instead of defining 50 variables its easy to define an array of 50 length
$a = [1,2,3,4,5,6,7,8,..........50]
Types Of Array in PHP
-
Numeric array
-
Associative array
-
Multidimensional array
1.Numeric array
Syntex :
$variable_name = array(value1,value2,value3.......,value n);
Example 1 :
$a = array(1,2,3,4,5,6,7,8);
Example 2 :
$b = array(a,b,c,d,e,f,g,h);
2.Associative array
Syntex :
$variable_name = array('key'=>'value','key'=>'value');
Example :
$user_info = array(
'name'=>'your_name',
'email'=>'your_email',
'age'=>'your_age',
);
3. Multidimensional array
Syntex :
$variable_name = array(
'key'=>array('key'=>'value','key'=>'value'),
'key'=>array('key'=>'value','key'=>'value'),
);
Example :
$marks = array(
'a' =>array('hindi'=>'60','english'=>'40'),
'b' =>array('hindi'=>'60','english'=>'40'),
);
Tutorial Topics
- PHP Mysql Tutorial for Beginners to Advance Full Course | Tutorial Introduction Part 1
- PHP Tutorial for Beginners to Advance Full Course Overview Part 2
- what is website | PHP Tutorial for Beginners to Advance Full Course | Part 3
- what is domain and hosting | PHP Tutorial for Beginners to Advance Full Course | Part 4
- what is WWW | PHP Tutorial for Beginners to Advance Full Course | Part 5
- what is internet | What is TCP IP Protocol | PHP Tutorial for Beginners to Advance Full Course | Part 6
- what is client server technology | PHP Tutorial for Beginners to Advance Full Course | Part 7
- what is PHP | Introduction of PHP | PHP Tutorial for Beginners to Advance Full Course | Part 8
- what is xampp and wamp web server | PHP Tutorial for Beginners to Advance Full Course | Part 9
- First Program Of PHP Hello Word | PHP Tutorial for Beginners to Advance Full Course | Part 10
- what is variable in PHP | PHP Tutorial for Beginners to Advance Full Course | Part 11
- what is data types and data types in PHP | PHP Tutorial for Beginners to Advance Full Course Part 12
- Print operation in PHP| echo| print r() | PHP Tutorial for Beginners to Advance Full Course part 13
- What is array in PHP | PHP Tutorial for Beginners to Advance Full Course | part 14
- What is Numeric array | PHP Tutorial for Beginners to Advance Full Course | part 15
- What is Associative array | PHP Tutorial for Beginners to Advance Full Course | part 16
- What is Multidimensional array | PHP Tutorial for Beginners to Advance Full Course | part 17
- What is Function in PHP | PHP Tutorial for Beginners to Advance Full Course | part 18
- what is comments in PHP | PHP Tutorial for Beginners to Advance Full Course | part 19
- include and require function in PHP | PHP Tutorial for Beginners to Advance Full Course |part 20
- control structure in PHP | PHP Tutorial for Beginners to Advance Full Course | part 21
- control structure if statement in PHP | PHP Tutorial for Beginners to Advance Full Course | part 22
- control structure in PHP | if-else statement in PHP | PHP Tutorial for Beginners to Advance Full Course | part 23
- PHP Tutorial for Beginners to Advance Full Course control structure if-else statement in PHP part 24
- PHP Tutorial for Beginners to Advance Full | Control Structure| switch case statement in PHP part 25
- PHP Tutorial for Beginners to Advance Full Loop Control Structure for loop in PHP part 26
- PHP Tutorial for Beginners to Advance Full Loop Control Structure while loop in PHP part 27
- PHP Tutorial for Beginners to Advance Full Loop Control Structure do while loop in PHP part 28