Accessing arrays accross php pages

Associate
Joined
19 Jun 2006
Posts
162
Location
Swansea, Wales
Hi,

I have an array that I want to use in a number of pages so i wrote it in a file arrays.php then included this page on my other pages. I wrote the array then wrote a function to return it...

Code:
<?php

		$fields = array	(	0=>"Accept",
								1=>"Accept-Encoding",
								2=>"Accept-Language",
								3=>"Alert-Info",
								4=>"Allow",
	                 			
function getFields() {
	
	return fields;
	
}

I was hoping to then just call the function from other pages to get the array...

Code:
$array = getFields();

... but it didn't work out that way! Where am I going wrong?
 
OK, cheers guys. I have been writing Java for the last 8 weeks and so my mind set is to get everything with a function! ;)
 
Back
Top Bottom