# $\_SESSION problem

**URL:** <https://forum.kirupa.com/t/-session-problem/239328>\
**Category:** programming\
**Created:** [September 20, 2007, 4:00pm UTC](https://forum.kirupa.com/t/-session-problem/239328 "2007-09-20T16:00:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![imagined](https://avatars.discourse-cdn.com/v4/letter/i/a87d85/32.png) [@imagined](https://forum.kirupa.com/u/imagined)\
**Post date:** [September 20, 2007, 4:00pm UTC](https://forum.kirupa.com/t/-session-problem/239328/1 "2007-09-20T16:00:31Z")

</div>

I used to name the $\_SESSION variable $\_SESSION[‘user’]. I was logged in with my webhosting provider. I tried to echo the session variable and my username of my webhosting provider would echo instead of the username of the script i was testing!

So I changed the $\_SESSION variable name to $\_SESSION[‘id’]. I have a login script that records the user’s id with the session variable $\_SESSION[‘id’]

But sometimes, when I try to echo it on a form, it comes out as Array.

So to find out what was going on I checked what was inside that array by doing this:

```php

foreach($_SESSION as $printit)
{
	echo '<li>'.$printit.'</li>';
}

```

It print two values:  
1  
Array

It was supposed to print the number 18 instead of the word array.

Any idea of what this problem might be?
