-4

I found this $css['misc/vertical-tabs.css']['data'] when reading Drupal book. I googled it but did not quite get the exact result.

I would like to know what does it mean "$var [] []"?

user229044
  • 232,980
  • 40
  • 330
  • 338
hangee
  • 719
  • 2
  • 9
  • 12
  • Please [don't use signatures or taglines in your posts](http://stackoverflow.com/faq#signatures). – user229044 Jul 03 '13 at 18:07
  • "As of PHP 5.4 you can also use the short array syntax, which replaces array() with []." http://www.php.net/manual/en/language.types.array.php – showdev Mar 05 '14 at 17:28
  • possible duplicate of [Reference - What does this symbol mean in PHP?](http://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php) – showdev Mar 05 '14 at 17:30

4 Answers4

5

$css is an array containing an element named 'misc/vertical-tabs.css' which is itself an array that contains an element named 'data'

IMSoP
  • 89,526
  • 13
  • 117
  • 169
Steven Mercatante
  • 24,757
  • 9
  • 65
  • 109
1

Its a 2-D array in php, read more about Arrays.

$test = array(
             array('swapnesh')
            );

echo $test[0][0]; // output- swapnesh
swapnesh
  • 26,318
  • 22
  • 94
  • 126
1

Brackets define array keys.

Example: $array[key][key] and so forth. It gets more complicated than that past 2 levels, but this is a fairly simple paradigm:

enter image description here

Rob W
  • 9,134
  • 1
  • 30
  • 50
0

well it's simply a 2-D array. For example, if you want to group certain things that assosiate to somethings together you might use this.

For example, $person['john']['age'] = 10; $person['john']['gender'] = 'male';....$person['john']['weight'] = '40kg'.

Suthan Bala
  • 3,209
  • 5
  • 34
  • 59