I have an array $attribs which looks like this:
Array ( [] =>
[195] => Brand Marketing Practice [185] => Change Management [902] => Clinical Trial Recruitment [196] => Corporate Practice [176] => Corporate Social Responsibility [177] => Entertainment Marketing [172] => Event and Experimental Marketing [197] => Food & Nutrition Practice [198] => Healthcare Practice [183] => Hispanic Marketing [179] => Influencer Marketing [772] => Interactive Communications [174] => Investor Relations [175] => Issues and Crisis Management [182] => Litigation Communications [186] => Lobbying [1] => Media Relations [171] => Media and Spokesperson Training [184] => Public Affairs [2] => Research [4] => Social Marketing [3] => Sports Marketing [199] => Technology Practice [187] => Women’s Marketing [261] => Word-of-Mouth Marketing )
I want to add another element "employee management" with key=185 ..how would i do this with array_push exactly?
array_push
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: array_push
You can't, array_push is the equivelant to calling
What you can do is,
or
Code: Select all
$foo[] = $bar;Code: Select all
$foo[184] = 'employee management';Code: Select all
$attribs = array_merge(array(184 => 'employee management'), $attribs);