add dimensional items to the array

Asked

Viewed 33 times

0

How can I add items to the array this way:

    array_push($arr, $end[0] => $end[1]);

did not want to add a new array within the existing one, but rather to add new items in the $key style => $content

to look like this:

        [A] => B
        [C] => D

and not like this:

array(
        array ( [A] => B ),
        array ( [C] => D )
)

1 answer

1

Well, then just make the direct inclusion in array:

$arr['A'] = 'B';
$arr['C'] = 'D';

Browser other questions tagged

You are not signed in. Login or sign up in order to post.