Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-07-2002, 05:01 PM   #1 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,446
sde is on a distinguished road
adding to an array in php

so i thought i'd write a little quick tip:

lets call this array $fruit

now i have 2 pieces of fruit in this array already .. there are 2 ways i can add another piece of fruit to the end of the array.

this is what we have:

$fruit[0]="apple";
$fruit[1]="pear";

now to add a bannana, i can do it one of 2 ways:

$fruit[]="bananna";

or

array_push($fruit,banna);


=-===========

i forgot how to add to the end of an array earlier and re-learned that today .. thought i'd pass it along.

-mike
sde is offline   Reply With Quote
Old 06-12-2002, 11:04 AM   #2 (permalink)
rdove
Masked Moderator
 
rdove's Avatar
 
Join Date: May 2002
Location: Indianapolis, IN
Posts: 260
rdove is on a distinguished road
ASP Arrays

And here is how you do it in ASP

Dim arrMyArray(2)

arrMyArray(0) = "Hello"
arrMyArray(1) = " World"

Session("arrMyArray") = arrMyArray

Add more:

Redim Perserve arrMyArray(3)

arrMyArray(2) = " !"

Session("arrMyArray") = arrMyArray
__________________
~Ryan

rdove is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
breaking down an array from a form metazai PHP 12 07-09-2004 06:18 AM
PHP Comes of Age sde Code Newbie News 0 04-14-2004 11:41 AM
PHP Regular Expressions Epsilon PHP 5 12-24-2003 07:36 AM
I need to learn PHP Nitro PHP 9 06-28-2003 11:24 AM
Php Vs. Asp sde PHP 6 06-06-2003 06:02 PM


All times are GMT -8. The time now is 04:52 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting