php merge arrays -


I am trying to merge the output of multiple arrays in an array (unsuccessful). One example I tried was:

  $ data1 = array ("cat", "goat"); $ Data2 = array ("dog", "cow"); Print_r (array_merge ($ data1, $ data2));   

It works fine, but I am using the following code, how can I get the desired output?

  $ filename = "item.txt"; $ Lines = array (); $ File = fopen ($ filename, "r"); Flexose ($ file); Foreign currency ($ lines in $ internally) {$ item = Ere ($ inner [1]); echo ";; My current output is:  
 Array ([0] = & gt; item one) array ([0] = & gt; two items) array ([0] => item three) array ([0] => item four )   

The desired product will be:

  Array ([0] => items one [1] => two items [2] = & Gt; Item Three [3] => Item Four)   

Anyone in Advanced Thanks for suggesting.

There may be a better way, but this should work. Loop through and combine each array separately:

  $ items = array (); Forex currency ($ lines in $ internally) {$ item = array ($ inner [1] ); $ Items = array_merge ($ item, $ item);} echo "prefix"; print_r ($ item); echo "   

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -