Global arrays

can i declare an array global which retains its value throughout the session
Please help me!
Thnks in advance

Yes, that is what $_SESSION is for.

Page1.php


<?php
session_start();
$data = array('foo', 'bar', 'baz');
$_SESSION['data'] = $data;
// go to page 2

Page2.php


<?php
session_start();
$data = $_SESSION['data'];
var_dump($data);

it’s probably easier to work in the $_SESSION superglobal directly though.