SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2005
    Location
    md
    Posts
    180
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    printing an array without showing array names

    I'm trying to echo out an array, and the only way I can get it to show is by using print_r(), but this shows the Array [0]==> information, which I don't want... does anyone know how I can print out just the value?

    Thanks!

  2. #2
    Kiwi Fr00t jylyn's Avatar
    Join Date
    Apr 2005
    Location
    New Zealand
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use a for loop:

    for($i = 0; $i <= count($array); $i++) {

    echo($array[$i]);

    }

  3. #3
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Or:
    PHP Code:
     $Array = array(=> 'a',=> 'b',=> 'c');
     foreach(
    $Array as $key => $value){
         print 
    $value.'<br>';
     } 
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  4. #4
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


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
  •