SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist jazztie's Avatar
    Join Date
    Mar 2001
    Location
    the Netherlands
    Posts
    519
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    simple Array problem... Grrrr

    I have a form which on submits goes to a next page where I have the following code
    PHP Code:
    print "$FunctionID"
    The page shows 'Array'
    So, I understand that $FunctionID is an Array... but how do I print each $FunctionID?

  2. #2
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    print "$FunctionID[2]";

    or

    print "$FunctionID[2,2]";

    is the way you access individual items in an array. The first way accesses a 1 dimensional array and the 2nd method is used to access a 2 dimensional array.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  3. #3
    SitePoint Evangelist jazztie's Avatar
    Join Date
    Mar 2001
    Location
    the Netherlands
    Posts
    519
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but than i would have to know how much items there are in the Array, right?

    That can differ... what should I do in that case?
    It can be 1, 2, 3 ......., 25 (for example, of course)

  4. #4
    SitePoint Zealot cokeman's Avatar
    Join Date
    Dec 2000
    Location
    So. California
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use count() to figure out how many elements you have and use a for loop to go through it...

    or you could use foreach to go through the array too..

  5. #5
    SitePoint Evangelist jazztie's Avatar
    Join Date
    Mar 2001
    Location
    the Netherlands
    Posts
    519
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanx codeman for the link.
    I knew there is a way to do it with 'foreach'. But I didn't know the syntax.

    But I found it and it works.
    You can also find it on: Zend PHP Manual


Bookmarks

Posting Permissions

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