I have both pages, but the $_SESSION["1"]
is not received in the 2nd one.
UPDATE: Turns out, that if I type a number in the session, it won't work. I typed a normal string and worked.. I never saw this happening
1st
<?php
session_start();
$_SESSION["1"] = "LOGGED";
?>
2nd
<?php
session_start();
echo $_SESSION["1"];
?>
Why isn't this working?
Session variables with a single number will not work, however
1a
will work, as willa1
and even a just single "letter"a
will also work.1st
2nd
Example from PHP.net manual on Session variables
Source: http://php.net/manual/en/language.types.array.php
EDIT:
bob-the-destroyer
's comment:To add regarding array keys, from php.net/manual/en/language.types.array.php, "Strings containing valid integers will be cast to the integer type". The manual on $_SESSION says "An associative array". So an associative array is expected literally...? It does no one any good if this bit of important info about accessing and storing session data remains buried in manual comments.