note 102576 deleted from function.array-merge by danbrown

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: bobkruithof at gmail dot com 

----

If you have a dynamic number of arrays ( sometimes 10, sometimes 15 or so ) stored in $someArrays, you can still merge them all together.

<?php
$amountOfArrays = count( $someArrays );
$mergedArray = Array();
for( $i=0; $amountOfArrays; $i++ ) {
   $mergedArray = array_merge( $mergedArray, $someArrays[$i] );
}
?>

Voila, you now hoave ALL the arrays in $someArrays merged together into $mergedArray :D
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.