11 Replies - 1360 Views - Last Post: 06 November 2011 - 04:52 AM Rate Topic: -----

#1 Snakeruler  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 09-April 10

Dimensional arrays

Posted 05 November 2011 - 10:53 AM

I've been making something, and I have an array, except it says there's an error in it, and I can't find anything wrong with it :/ Can anyone else see anything with it?

<?php 
$text = array(
			"en" => array( //English
								"blog" => array(
									"rank" => "I am a " //I am a
								),
								"uni" => array(
									"profile" => "Profile",
									"sign in" => "Sign in",
									"search" => "Search",
									"username" => "Username",
									"password" => "Password",
									"sign up" => "Sign up",
									"forgotten password" => "Forgotten password?"
								),
								"rank" => array(
									"user" => "User",
									"moderator" => "Moderator",
									"administrator" => "Administrator"
								)
			),
			"fr" => array( //French
								"blog" => array(
									"rank" => "Je suis un " //I am a
								),
								"uni" => array(
									"profile" => "Profil",
									"sign in" => "Connexion",
									"search" => "Chercher",
									"username" => "Nom d'utilisateur",
									"password" => "Mot de passe",
									"sign up" => "Registrer",
									"forgotten password" => "Oubliť vorte mot de passe?"
								),
								"rank" => array(
									"user" => "l'utilisateur",
									"moderator" => "Moderator",
									"administrator" => "Administrator"
								)
			),
			"de" => array( //German
								"blog" => array(
									"rank" => "Ich bin ein " //I am a
								),
								"uni" => array(
									"profile" => "Profil",
									"sign in" => "Anmelden",
									"search" => "Suchen",
									"username" => "Benutzername",
									"password" => "Passwort",
									"sign up" => "Registrieren",
									"forgotten password" => "Passwort vergessen?"
								),
								"rank" => array(
									"user" => "Benutzer",
									"moderator" => "Moderator",
									"administrator" => "Administrator"
								)
			),
			"nl" => array( //Dutch
								"blog" => array(
									"rank" => "Ik ben een " //I am a
								),
								"uni" => array(
									"profile" => "Profil",
									"sign in" => "Aanmelden",
									"search" => "Zoeken",
									"username" => "Gebruikersnaame",
									"password" => "Wachtwoord",
									"sign up" => "Registreren",
									"forgotten password" => "Wachtwoord vergeten?"
								),
								"rank" => array(
									"user" => "Gebruikers",
									"moderator" => "Moderator",
									"administrator" => "Administrator"
								)
			),
			"no" => array( //Norwegian
								"blog" => array(
									"rank" => "Du er en " //I am a
								),
								"uni" => array(
									"profile" => "Profil",
									"sign in" => "Logg inn",
									"search" => "SÝk",
									"username" => "Brukernavn",
									"password" => "Passord",
									"sign up" => "Registrer",
									"forgotten password" => "Glemt passordet?"
								),
								"rank" => array(
									"user" => "Bruker",
									"moderator" => "Moderator",
									"administrator" => "Administrator"
								)
			)
);
?>


Is This A Good Question/Topic? 0
  • +

Replies To: Dimensional arrays

#2 creativecoding  Icon User is offline

  • Hash != Encryption
  • member icon


Reputation: 931
  • View blog
  • Posts: 3,216
  • Joined: 19-January 10

Re: Dimensional arrays

Posted 05 November 2011 - 10:58 AM

multi multi arrays, I'm not sure if that's possible.

like, you can do

array(array("red", "green", "blue"), array(1, 2, 3), awesomesauce)


but not

array(array(array("hi", "bye")), "how's it going?")

Was This Post Helpful? 0
  • +
  • -

#3 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4136
  • View blog
  • Posts: 13,052
  • Joined: 08-June 10

Re: Dimensional arrays

Posted 05 November 2011 - 11:01 AM

I donít see something wrong (my PHP also not)
Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6245
  • View blog
  • Posts: 24,013
  • Joined: 23-August 08

Re: Dimensional arrays

Posted 05 November 2011 - 11:02 AM

Quote

it says there's an error in it


Swell. Good luck with that. Thankfully, we all have remote webcams trained on your monitor so we can see your errors. All part of the magic that is Dream.In.Code. Someone will be right with you.
Was This Post Helpful? 2
  • +
  • -

#5 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4136
  • View blog
  • Posts: 13,052
  • Joined: 08-June 10

Re: Dimensional arrays

Posted 05 November 2011 - 11:03 AM

View Postcreativecoding, on 05 November 2011 - 06:58 PM, said:

but not

array(array(array("hi", "bye")), "how's it going?")

why not?
Was This Post Helpful? 0
  • +
  • -

#6 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3714
  • View blog
  • Posts: 13,468
  • Joined: 08-August 08

Re: Dimensional arrays

Posted 05 November 2011 - 11:04 AM

Multidimensional arrays often cry out for objects. Unless you need to iterate over the entire array for some calculation, and it doesn't look like you do, then you should think about using an array of objects.
Was This Post Helpful? 0
  • +
  • -

#7 Jstall  Icon User is offline

  • Lurker
  • member icon

Reputation: 434
  • View blog
  • Posts: 1,042
  • Joined: 08-March 09

Re: Dimensional arrays

Posted 05 November 2011 - 11:10 AM

Hi,

I don't get an error when I run your code. Could you be more specific?
Was This Post Helpful? 0
  • +
  • -

#8 Snakeruler  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 09-April 10

Re: Dimensional arrays

Posted 05 November 2011 - 01:25 PM

View PostJstall, on 05 November 2011 - 11:10 AM, said:

Hi,

I don't get an error when I run your code. Could you be more specific?


I get:

Parse error: syntax error, unexpected ';', expecting ')' on line 1
Was This Post Helpful? 0
  • +
  • -

#9 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6245
  • View blog
  • Posts: 24,013
  • Joined: 23-August 08

Re: Dimensional arrays

Posted 05 November 2011 - 02:12 PM

I'm going to venture a guess that that is not the entire code involved.
Was This Post Helpful? 0
  • +
  • -

#10 Snakeruler  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 09-April 10

Re: Dimensional arrays

Posted 05 November 2011 - 03:05 PM

View PostJackOfAllTrades, on 05 November 2011 - 02:12 PM, said:

I'm going to venture a guess that that is not the entire code involved.


That's all the code there is. And it's getting the error.
Was This Post Helpful? 0
  • +
  • -

#11 Snakeruler  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 09-April 10

Re: Dimensional arrays

Posted 05 November 2011 - 03:33 PM

I fixed the error.

It was because there were comments in the array.
Was This Post Helpful? 0
  • +
  • -

#12 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6245
  • View blog
  • Posts: 24,013
  • Joined: 23-August 08

Re: Dimensional arrays

Posted 06 November 2011 - 04:52 AM

That's weird, where no one else is seeing this problem. Particularly where the error says line 1. That is what made me think that there was some other code involved, like perhaps an included file.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1