note 42470 added to ref.array
| From: | arca77 at libertysurf dot fr | Date: | Tue, 18 May 2004 09:44:29 +0000 |
| Subject: | note 42470 added to ref.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69748@lists.php.net to get a copy of this message | ||
<?php
$Return = array();
array_push($Return , 'Brand1');
$Return['Brand1']= array();
$temp = array(_mod =>'mod11',_ref => 'ref11');
array_push($Return['Brand1'], $temp);
$temp = array(_mod =>'mod12',_ref => 'ref12');
array_push($Return['Brand1'], $temp);
$temp = array(_mod =>'mod13',_ref => 'ref13');
array_push($Return['Brand1'], $temp);
$Return['Brand2']= array();
$temp = array(_mod =>'mod21',_ref => 'ref21');
array_push($Return['Brand2'], $temp);
echo "Return value <br> \n";
print_r($Return);
echo "\n";
?>
And the result is ...
--------
Return value <br>
Array
(
[0] => Brand1
[Brand1] => Array
(
[0] => Array
(
[_mod] => mod11
[_ref] => ref11
)
[1] => Array
(
[_mod] => mod12
[_ref] => ref12
)
[2] => Array
(
[_mod] => mod13
[_ref] => ref13
)
)
[Brand2] => Array
(
[0] => Array
(
[_mod] => mod21
[_ref] => ref21
)
)
)
----
Manual Page -- http://www.php.net/manual/en/ref.array.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42470
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42470&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42470&report=yes
Search -- http://master.php.net/manage/user-notes.php