2D arrays in php.

C++, C#, Java, PHP, ect...
Post Reply
User avatar
VZdemon
Posts: 93
Joined: Thu Nov 25, 2010 1:55 pm

2D arrays in php.

Post by VZdemon »

does any1 know how to make a 2d array in php
it's VZdaemon on xbox live
Xaleph
Posts: 897
Joined: Mon Feb 07, 2011 2:55 am

Re: 2D arrays in php.

Post by Xaleph »

Code: Select all

$array['first'] = array("second" => array(
  "third" => array("
               fourth" => array(
                         "fifth" => array()))
));
Like this? First is a first dimension, second is 2 dimensional, third is 3d dimension, et cetera.
User avatar
VZdemon
Posts: 93
Joined: Thu Nov 25, 2010 1:55 pm

Re: 2D arrays in php.

Post by VZdemon »

ty
it's VZdaemon on xbox live
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: 2D arrays in php.

Post by hallsofvallhalla »

or if you want to do it the fun way to be different

$be_an_ahole = "first second third fourth fifth";
$my_ahole_array = explode(" ",$be_an_ahole);

echo $my_ahole_array[0];
echo $my_ahole_array[1];
User avatar
VZdemon
Posts: 93
Joined: Thu Nov 25, 2010 1:55 pm

Re: 2D arrays in php.

Post by VZdemon »

loooooooooool :lol: :lol: :lol:
it's VZdaemon on xbox live
Post Reply

Return to “Coding”