Jump to content

How do I print all environment variables (with names and values)?


Rasekamon

Recommended Posts

*sigh*

$_ENV is an array. So you can process it like any other array.

Write some code and we can help, but I won't do it for you. If you can't get started, either this is too complex a task for you, or you're not stating the problem clearly.

Link to comment
Share on other sites

Haha, thanks for your answers. Yeah it's homework.. and I just watched your little youtube link of "don't be this kid!!".. I'm totally that kid.

 

But ok, I'll freshen up on my array-skillz and try to do some loop that prints it all. Hope it's the right way to go :-)

Link to comment
Share on other sites

Ah interesting. <pre> makes it look tidy and print_r() prints all the elements of the array. Neat!

 

Though it seems the array $_ENV is empty but the $_SERVER is full of stuff (I printed both):

 

"Array

(

)

Array

(

    [HTTP_HOST] => 127.0.0.1

    [HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13

    ... etc."

 

Thanks for your help. It's progress :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.