I have 2 files that put something in the $ _SESSION array. file1.php
<?php
session_start();
$_SESSION[] = 'Hi';
echo '<pre>';
print_r($_SESSION);
echo '</pre>';
What prints
Array
(
[0] => Hi
)
And file2.php, which is similar to file1
<?php
session_start();
$_SESSION[] = 'There!';
echo '<pre>';
print_r($_SESSION);
echo '</pre>';
Suppose you first go to file1, and then go to file2. Printing $ _SESSION in file2 should output
Array
(
[0] => Hi
[1] => There!
)
I am wrong?
I should mention that I am getting a notification: Unknown, skipping the numeric key 0 in Unknown on line 0. And register_globals in my php.ini is Off.
As I see in the comments for one of you, file2 prints an array of two elements, and for some (for example, me) the "hello" elements are lost. This happens, but not for Marc B, only if we use the number as an index to the session array, not a string.
Marc B , . php.ini ? , ?