Nope, there is no array_push()
equivalent for associative arrays because there is no way determine the next key.
You’ll have to use
$arrayname[indexname] = $value;
More Related Contents:
- how can i passed array into a function in php [closed]
- Needle in a Haystack for Php [closed]
- Multiple inputs with same name through POST in php
- Creating one array from another array in php [closed]
- Filter array by its keys using an array of allowed keys
- How to echo or print an array in PHP?
- php stdClass to array
- Checking to see if one array’s elements are in another array in PHP
- PHP: Sort an array by the length of its values?
- PHP array multiple sort – by value then by key?
- Storing PHP arrays in cookies
- Return index of highest value in an array
- PHP remove duplicate values from multidimensional array
- Get week number in month from date in PHP?
- Display array values in PHP
- How can I force PHP to use strings for array keys? [duplicate]
- Create a comma-separated string from a single column of an array of objects
- How to filter an associative array comparing keys with values in an indexed array?
- Rotate array elements to the left (move first element to last and re-index)
- Grouping arrays in PHP
- Parse error: Invalid numeric literal
- Group 2d array data using column value to create a 3d array
- While destructuring an array, can the same element value be accessed more than once?
- Remove unwanted elements from subarrays in multidimensional array
- Concatenate values of n arrays in php
- How to convert array to a string using methods other than JSON?
- How to insert json array into mysql database
- Why do I get “Resource id #4” when I apply print_r() to an array in PHP? [duplicate]
- How to set an option from multiple options or array with different values to views as selected in select box using PHP
- Remove zero values from a PHP array