SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Wizard Wolf_22's Avatar
    Join Date
    Jul 2005
    Posts
    1,710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    $_SERVER issues...

    How can I see what's stored in this? I've tried placing it in a printf or simply echoing the array... All to no avail. Apparently I'm misunderstanding something about this array?

  2. #2
    SitePoint Evangelist AlienDev's Avatar
    Join Date
    Feb 2007
    Location
    UK
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    print_r($_SERVER);
    Me on StackOverflow | Blog & personal website.

    I mostly use: PHP, Java, JavaScript, Android.

  3. #3
    SitePoint Wizard Wolf_22's Avatar
    Join Date
    Jul 2005
    Posts
    1,710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AlienDev View Post
    print_r($_SERVER);
    Looks like I'm getting some listings now.
    Is there any way to make it display a bit neater though? More organized?

  4. #4
    SitePoint Guru
    Join Date
    Jul 2005
    Location
    Orlando
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Either view the source or wrap out the output in pre tags.

    Another option is to turn it into a table. You should probably create a function and place it into your library for that..

    PHP Code:

    echo "<table border='1' cellpadding='4'>";
    foreach( 
    $_SERVER as $key => $value )
      echo 
    "<tr><td>$key</td><td>$value</td></tr>";
    echo 
    "</table>"

  5. #5
    SitePoint Wizard Wolf_22's Avatar
    Join Date
    Jul 2005
    Posts
    1,710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by UFTimmy View Post
    Either view the source or wrap out the output in pre tags.

    Another option is to turn it into a table. You should probably create a function and place it into your library for that..

    PHP Code:

    echo "<table border='1' cellpadding='4'>";
    foreach( 
    $_SERVER as $key => $value )
      echo 
    "<tr><td>$key</td><td>$value</td></tr>";
    echo 
    "</table>"
    Awesome. Thanks!

  6. #6
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    download and install xdebug then just do var_dump() that will display neater.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  7. #7
    SitePoint Evangelist catweasel's Avatar
    Join Date
    Apr 2007
    Location
    Goldfields, VIC, Australia
    Posts
    518
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I usually use -
    PHP Code:
    printf("<pre>%s</pre>",print_r($_SERVER,1)); 

  8. #8
    SitePoint Member
    Join Date
    Sep 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    echo "<table border='1' cellpadding='4'>";

    foreach( $_SERVER as $key => $value )

    echo "<tr><td>$key</td><td>$value</td></tr>";

    echo "</table>";


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
  •