Jump to content

arrays ! help


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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...