Web Analytics Made Easy -
StatCounter Display parts of an array - CodingForum

Announcement

Collapse
No announcement yet.

Display parts of an array

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Display parts of an array

    I have this array

    PHP Code:
    $users[] = array("".$row['fuserid']."" => $row['fname'].$row['fname']); 
    I need to display the fuserID and fname from the array, but im not sure how i would do it, can anyone help?

  • #2
    Hy
    Try this code:
    Code:
    foreach($users as $k=>$v) {
    echo '<br/>key = '. $k. ' , val = '. $v;
    }

    Comment


    • #3
      I've tried that before and that just echoes key - 0 and val - Array

      Comment


      • #4
        Sorted it, i really should stop trying to code at 5am :P

        PHP Code:
            foreach ($users as $key => $value
                {
                    foreach (
        $value as $k => $v)
                    {
                        echo 
        "Key 2: $k; Value 2: $v<br />\n";
                    }
                } 

        Comment

        Working...
        X