array question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Guy
Forum Commoner
Posts: 53
Joined: Sun Jan 12, 2003 3:34 am

array question

Post by Guy »

I want to init a two dimensional array with constant values.
I can do it like this:

Code: Select all

$Arr = array(	array(1,2),
		array(3,4),
		array(5,6) );
can i do it like in c:

Code: Select all

$Arr = array(	{1,2}; or (1,2);
		{3,4}; or (3,4);

)
or something close to that syntax - i mean without calling array for each item? ( i got an error with the examples above)
Guy
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

try the first one and you'll be happy ;)
Post Reply