By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,748 Members | 1,427 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,748 IT Pros & Developers. It's quick & easy.

second array level

P: n/a
Dear all
How can I directly acces the second level of an array.

At the moment I am doing something like this.
$subset=$ini_array["section"];
$number=$subset["number"];
I would like to increment number by 1 without storing the data in a
different variable.
($ini_array["section"])["number"]


Array
(
[section] => Array
(
[number] => 1
)
)

regards

Reimar
--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.*****@fz-juelich.de
-------------------------------------------------------------------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/i...lib_intro.html
================================================== =================
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Reimar Bauer wrote:
Dear all
How can I directly acces the second level of an array.

At the moment I am doing something like this.
$subset=$ini_array["section"];
$number=$subset["number"];
I would like to increment number by 1 without storing the data in a
different variable.
($ini_array["section"])["number"]


$ini_array["section"]["number"]++;

OR

++$ini_array["section"]["number"];

will do it.

see
http://www.php.net/manual/en/languag....increment.php

and
http://www.php.net/manual/en/language.types.array.php
see the third example of how to access an item from a multi-dimensional
array directly.

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.