Results 1 to 5 of 5

Thread: Creating Arrays -[RESOLVED]-

  1. #1

    Thread Starter
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349

    Resolved Creating Arrays -[RESOLVED]-

    How do I make arrays, inparticular the ones that use strings instead of indexes .
    Last edited by Electroman; Nov 17th, 2004 at 05:55 PM.
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    PHP Code:
    Array ('index1' => 'value1''index2' => 'value2''index3' => 'value3'); 
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    How about adding to an array after it was first created, or must you clear it and make a new one for that?

    Also how about Multidimensional ones .


    P.S. that was quick .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    The reply was even quicker .

    There are hundreds of array functions that do just about everything you can hope for with array manipulation. You have functions like array_pop() and array_push() that let you turn it into a stack, you have merging functions, traversing functions, sorting functions, combining functions, adding functions, padding functions, callback functions ....

    ok you get my drift, heres the full list.

    http://uk2.php.net/manual/en/ref.array.php

    Multi dimensional arrays are made by putting one array inside another.
    PHP Code:
    Array (Array(1,2,3,4,5), Array(3,4,5,6,7)); 
    To add a value to an array which has already been initialized, just omit the index:
    PHP Code:
    $array = Array(1,2,3,4);

    $array[] = 5
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  5. #5
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    PHP Code:
    $main_list = array();
    $main_list[0] = "Home";
    $main_list[1] = "PHP";
    $main_list[2] = "Links";
    $main_list[3] = "Contact"
    for multi dimensional:
    PHP Code:
    $smt = array();
    $smt [0] = array("one","two");
    $smt [1] = array("abc","def");
    $smt [2] = array("123","456");
    $smt [3] = array("alpha","omega"); 
    to call something from a one dimensional array use:
    PHP Code:
    $main_list[0
    to call something from a multi dimensional array use:
    PHP Code:
    $main_list[0][0
    to see how many items in an array do
    PHP Code:
    count($arrayname
    edit: at least that is my neat and readable (for me) way of doing things.
    Have I helped you? Please Rate my posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width