$myArray[] = 'new element';
This will add element to php array at its end
PHP Coding tips & tricks. Function & error explanation, coding style, how tos etc. Short notes posted directly from developer work environment.
PHP Coding Tips
Showing posts with label add. Show all posts
Showing posts with label add. Show all posts
Friday, August 17, 2012
PHP Array add element - how to append element to an array
If you have a PHP array and wants to add element to it, you can do it just in this way:
Friday, August 10, 2012
How to add element to an array ?
If you want how to add or append element to a PHP array, see this code snippet:
$somethings = array();
$somethings[] = "element"; // append as last element
$somethings[4] = "other element";
$somethings['thekey'] = "some other element";
Subscribe to:
Posts (Atom)