Aytar A.
0
Q:

php multidimensional array

$cars = array
  (
  array("Volvo",22,18),
  array("BMW",15,13),
  array("Saab",5,2),
  array("Land Rover",17,15)
  );
2

 $cars = array
  (
  array("Volvo",22,18),
  array("BMW",15,13),
  array("Saab",5,2),
  array("Land Rover",17,15)
  );
2
$users = [
	'users' => ['[email protected]','[email protected]'],
	'admins' => ['[email protected]', '[email protected]']
];

// function to convert array of arrays to string
function implodeArrayofArrays($array, $glue  = ', ') {
        $output = '';
        foreach ($array as $subarray) {
            $output .= implode($separator, $subarray);
        }
        return $output;
}

echo implodeArrayofArrays($users);

// "[email protected], [email protected], [email protected], [email protected]"
0
<?php 
/* 
There are 3 Types of array in php  
1. Indexed arrays - Arrays with a numeric index
2. Associative arrays - Arrays with named keys
3. Multidimensional arrays - Arrays containing one or more arrays

This is the third one - Multidimensional arrays
*/

$carsModel = array
  (
  array("Maruti",21,28),
  array("BMW",05,75),
  array("Tata",25,12),
  array("Land Rover",11,20)
  );
?>
0
$cars = array(
  array("Volvo",22,18),
  array("BMW",15,13),
  array("Saab",5,2),
  array("Land Rover",17,15)
);
0

New to Communities?

Join the community