In PHP, you can add an element to an array using the array_push()
function or by simply assigning a new value to the next index in the array.
Using array_push()
:
main.php101 chars5 lines
Direct assignment to the next index:
main.php65 chars4 lines
Both of these methods will add the element '5' to the end of the array.
gistlibby LogSnag