Types of Array In PHP : Samee Articles
Sample 1 : Types of Array in PHP.
Types of Array In PHP- Indexed arrays - Arrays with numeric index
- Associative arrays - Arrays with named keys
- Multidimensional arrays - Arrays containing one or more arrays
Sample 2 : Indexed Arrays Example And Use in PHP.
My 1st name is Samee.My Last Name is Feroz
My Cast is Sheikh.
array (size=4) 0 => string 'Samee' (length=5) 1 => string 'Ullah' (length=5) 2 => string 'Feroz' (length=5) 3 => string 'Sheikh' (length=6)Values in Array = 4
Sample 3 : Associative arrays Example And Use in PHP.
My 1st name is Samee .My Last Name is Feroz
My Cast is Sheikh.
array (size=4) 'firstname' => string 'Samee' (length=5) 'middlename' => string 'Ullah' (length=5) 'lastname' => string 'Feroz' (length=5) 'cast' => string 'Sheikh' (length=6)
Sample 4 : Multidimensional arrays arrays Example And Use in PHP.
array (size=2) 0 => array (size=4) 0 => string 'Samee' (length=5) 1 => string 'Ullah' (length=5) 2 => array (size=1) 0 => string 'Sheikh' (length=6) 'cast' => string 'Sheikh' (length=6) 1 => string 'Feroz' (length=5)My 1st name last part is Ullah
<html>
<head>
<title><?php $pagetitle="Types of Array In PHP : 6th Day Lecture : Samee";
echo $pagetitle; ?></title>
<meta name="description" content="<?php echo $pagetitle ?>" />
<meta name="robots" value="nofollow, noindex" />
<link rel="icon" type="image/ico" href="http://www.iconarchive.com/download/i50954/deleket/3d-cartoon-vol3/Web-Coding.ico" alt="Icon" />
<link type="text/css" href="http://www.getacho.com/download/phpcss/stylesheet.css" rel="stylesheet" />
</head>
<body>
<img id="logo" src="http://icons.iconarchive.com/icons/deleket/3d-cartoon-vol3/256/Web-Coding-icon.png" alt="Coding">
<h1 align="center">Types of Array In PHP : <a href="http://sameearticles.blogspot.com" target="_blank">Samee Articles</a></h1>
<h2 align="left">Sample 1 : Types of Array in PHP.</h2>
<?php
echo "Types of Array In PHP <br />";
echo
"<ol type=\"a\">
<li>Indexed arrays - Arrays with numeric index</li>
<li>Associative arrays - Arrays with named keys</li>
<li>Multidimensional arrays - Arrays containing one or more arrays</li>
</ol> <br />";
?>
<h2 align="left">Sample 2 : Indexed Arrays Example And Use in PHP.</h2>
<?php
$name = array("Samee", "Ullah", "Feroz"); //It is the way to add an index array
$name[3]="Sheikh"; //It is the way to add a value to 3rd number of array, it is custom way
echo "My 1st name is $name[0]. <br />";
echo "My Last Name is " . $name[2] . "<br />";
echo "My Cast is {$name[3]}. <br>";
var_dump($name);
echo "Values in Array = \t" . count($name); //this function is for counting the values of Array
?>
<h2 align="left">Sample 3 : Associative arrays Example And Use in PHP.</h2>
<?php
$name = array("firstname"=>"Samee","middlename"=>"Ullah","lastname"=>"Feroz"); #It is the way to add an assosiative array
$name['cast'] = "Sheikh"; //you can use double or single qoutes both methods with in []
echo "My 1st name is {$name["firstname"]} . <br />";
echo "My Last Name is " . $name["lastname"] . "<br />";
echo "My Cast is {$name["cast"]}. <br>";
var_dump($name);
?>
<h2 align="left">Sample 4 : Multidimensional arrays arrays Example And Use in PHP.</h2>
<?php
$name= array(array("Samee","Ullah"),"Feroz"); //array within array is called multidimensional array
/*$name[0][2][0]="Sheikh";*/ //1st way to write one integer between array
$name[0]["cast"]="Sheikh"; //2nd way to write one integer between array
var_dump($name);
echo "My 1st name last part is ". $name[0][1]; //it is used to find the path
?>
</body>
</html>
Post a Comment
Give your reviews about this blog. Leave your comments. what do you think about this post?
Comments Description is given below:
1) I love to read comments, but do not spam.
2) Like this blog and also tweet its posts.
3) You can use some xHTML tags.
4) All Comments are Do Follow, Please try to use blog professionally.
5) Mention Your Name below the comment.
6) You can also suggest for improvement.
7) Do not forget to subscribe Samee Articles blog.
---------------------------------------
Thanks for visiting QWC.Me.
==========================================
For free guidelines contact me on SEO Expert | Samee Ullah Feroz is online there.
==========================================
Best Regards