Assigning an array to a single key in php -
I'm trying to provide one key with an array.
The array of values as I am trying to assign is as follows:
$ entity_items_array [$ entity_restrict] = $ entity_items;
The key, $ entity_restrict, looks like this:
array, $ entity_items looks like this:
= 1] [2] => 2 [3] => 3 [4] = & Gt; 4 [5] => 5 [6] => 6 [7] => 7 [8] = 8] [9] => 9 [10] = & Gt; 10 [11] => 11 [12] => 12 [13] => 13 [14] => 14 [15] => 15 [16] = & gt; ; 16 [17] = & gt; 17 [18] => 18 [19] => [20] = 20 [21] => 21)
And I'm trying to assign a key like this:
But for some reason, when I look at $ entity_items_array, I get the value:
array ([0] => users)
What am I doing wrong? Am I not assigning data correctly?
The code you posted seems to work, I took it and re-presented it and it Found:
$ entity_items_array = array (); $ Entity_restrict = 'User'; $ Entity_items = array (0 => 0, 1 => 1, 2 => 2, 3 => 3); $ Entity_items_array [$ entity_restrict] = $ entity_items; Print_r ($ entity_items_array);
This Outlook:
array ([user] = & gt; array ([0] => 0 [1] = & gt; 1 [2] = & gt; 2 [3] = & gt; 3))
Comments
Post a Comment