Live coverage of Fall Internet World '99! logo

internet.com
Join the free
WDVL newsletter!

home

Adding elements to a list array

Adding elements to a list array

  • Likewise, you can add to or modify the values of an existing array by simply referencing the array by number. For example, to add an element to @available_colors, you might use the following line:

    $available_colors[4] = "orange"; 
    

  • Thus, @available_colors would include the elements: red, green, blue, brown, and orange.

  • You can also use this method to overwrite an element in a list array. To change a value in @available_colors, you might use the syntax:

    $available_colors[0] = "yellow"; 
    

  • Now, the elements of @available_colors would be: yellow, green, blue, brown, orange.

Figuring out how many elements are in an array
Table of Contents
Deleting and replacing list elements with the splice function

Up to => Home / Authoring / Scripting / Tutorial

Instantly look up a "techie" word using Webopedia!!


internet.com
e-commerce
WebDeveloper Network


Live coverage of Fall Internet World '99!

Copyright 1999 internet.com Corporation. Legal Notices. Privacy Policy.

www.internet.com