Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 26-02-2010
Member
 
Join Date: Nov 2009
Posts: 446
Array of array in PHP

Sir !
I need some guidance about the array of array concepts in the PHP programming. I am planning to develop a small and static application in the PHP which would be helpful for my college to view the students records.Can you help me to construct and manage the array of array application.

Thanks .
Reply With Quote
  #2  
Old 26-02-2010
Member
 
Join Date: Apr 2008
Posts: 1,948
Array of array in PHP

Array of array in PHP

The array of array concept is used to manage different sub-variables using only one variable in the programming.

The array of array concept is always used in every programming languages to store the large number of variable which have always same types.

It is also known as Multidimensional array which has two types of construction :

1- Two-dimensional Arrays
2- Three-dimensional Arrays
Reply With Quote
  #3  
Old 26-02-2010
Member
 
Join Date: May 2008
Posts: 2,008
Constructing Array of array in PHP

Constructing Array of array in PHP

You can construct the array of array (multidimensional array) same as you create a single dimensional array but there is a little bit difference with the construction.

We use the nested structure to define that array of array,The example format is given below :

Code:
<?php
$<Variable_name> = array(
                        array( ) //one dimensional array
                        array( ) // One dimensional array 
                     ); 
?>
Because,the one dimensional array is defined coated with one array so this would called as array of array.
Reply With Quote
  #4  
Old 26-02-2010
Member
 
Join Date: Apr 2008
Posts: 2,001
Two dimensional in PHP

Two dimensional in PHP

Suppose, you are the shopkeeper of a chocolate shop.One-dimensional can able to provide you to store the titles and prices. In case, if you want to have Number of items of each one then you have to use another thing - You can store it using multidimensional arrays. Just tag the name of title and put the values whatever you have.

To collect the data in format of array which is going to shown by preceding example using PHP,Ready to do the following code:

Code:
<?php
$Chocoshop = array( array("Cadbury", 3.25 , 3),
               array("Guylian", 2.75 , 12),
               array("Belgian chocolate", 12.4 , 5) 
             ); 
?>
Reply With Quote
  #5  
Old 26-02-2010
Member
 
Join Date: May 2008
Posts: 2,293
Three dimensional array in PHP

Three dimensional Array in PHP

You are not bothered to use only two dimensions.The programming provides more than one way as you need .The new concept in the series that you can apply within the two dimensional and makes a long chain of variables means the array elements would be kept in the another arrays.

To view the result of the three dimensional array,you can use the loop control.The syntax for Three dimensional would be as follows:

Code:
<?php
$Var_name = array(
                    array(array(),
                            array(),
                            array() 
                           ),
                    array(array(),
                            array(),
                            array() 
                          ),
                   ..................
                   ............
                   .......
                   ....       )
                       );
?>
Now this would be the structure of the three dimensional array which makes a long chain of further variable.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Array of array in PHP"
Thread Thread Starter Forum Replies Last Post
C# array help Daren Software Development 5 03-01-2010 07:12 AM
Assigning an array to an array MACE Software Development 3 18-11-2009 05:19 PM
XML to ARRAY Vandam Software Development 3 29-06-2009 06:14 PM
Array Functions in PHP SuperXCM Software Development 2 26-03-2009 10:57 AM
JAVA array Daren Software Development 2 06-03-2009 06:13 PM


All times are GMT +5.5. The time now is 09:55 PM.