note 31621 deleted from ref.array by didou

From: Date: Sun, 18 May 2003 01:24:38 +0000
Subject: note 31621 deleted from ref.array by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-48321@lists.php.net to get a copy of this message
Note Submitter: ---- this simple function will append array $a2 to array $a1 and return the total number of elements added function array_append(&$a1, $a2) { if( !is_array($a1) || !is_array($a2) ) return 0; foreach( $a2 as $val ) $a1[] = $val; return count($a2); } Ex: $arr = array(1,2,3,4); array_append($arr, array(5,6,7,8)); print_r($arr); Output ------ Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 )

« previous php.notes (#48321) next »