Jump to content

arrays ! help


razi89

Recommended Posts

i have two phps name : random.php and data.php .

Random.php is use to generate a array with set of random values inside ,code is like -

//random.php (CURRENT)//here some code to generate random values.$array1 = array ("a","b","c");include('data.php');

in data.php i have data of arrays like this:

//data.php (CURRENT)$file = array($a=> array		(		"price" => 35,	    		"label" => 30,	    		"off" => 39	    		)//$b,$c are same type array as $a	     );

now i want that the that the values from data.php get stored into $array1 from random.php somehow , because i will be sending that data to my webpage for display. #note i require two separate php files .

Link to comment
Share on other sites

In what way do you want the data put into the array?

 

You could append the entire $file array as an element of $array1.

$array1[] = $file;

You could add each element in $file as an element of $array1.

foreach($file as $element) {    $array1[] = $element;}

Maybe you want $array1 to be an element in the $file array instead. I don't know, you haven't described your data structure well enough for me.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...