razi89 Posted October 24, 2014 Share Posted October 24, 2014 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 More sharing options...
niche Posted October 24, 2014 Share Posted October 24, 2014 array_merge() or some variant. Here's the list: http://www.w3schools.com/php/php_ref_array.asp Link to comment Share on other sites More sharing options...
Ingolme Posted October 24, 2014 Share Posted October 24, 2014 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now