Originariamente inviato da grifis78
Ho risolto usando array_push($_SESSION['id'], $_GET['id']);

Mi sovviene in mente però un altro problema... in effetti, io volevo usare un indice come nel primo post (cioè $_SESSION[$i], invece che $_SESSION['id][$i], come gentilmenente mi avete suggerito) perchè oltre l'id volevo memorizzare anche altri dati come ad esempio cognome, nome, ecc. Ecco qual'era esattamente la mia idea:

$_SESSION[0]['id']['cognome']['nome']
$_SESSION[1]['id']['cognome']['nome']
$_SESSION[2]['id']['cognome']['nome']
$_SESSION[3]['id']['cognome']['nome']

ove ovviamente, il primo indice numerico lo ricavo dalla variabile $i.
Ho creato scripts on questi scopi molto facilmente usando un database, ma volevo ragionare un pò sull'utilizzo degli array.
non si puo' usare un indice numerico o che inizi con un numero con $_SESSION. E' soggetto a tutte le limtazioni sintattiche previste dalle variabili del php.

In altre parole ... il primo indice dell'array $_SESSION deve essere compatibile con i nomi assegnabili ad una variabile.

Variable names follow the same rules as other labels in PHP. A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'

Nota: For our purposes here, a letter is a-z, A-Z, and the ASCII characters from 127 through 255 (0x7f-0xff).

Nota: $this is a special variable that can't be assigned.