note 56424 deleted from function.array-combine by bjori

From: Date: Thu, 21 Feb 2008 20:24:45 +0000
Subject: note 56424 deleted from function.array-combine by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-136365@lists.php.net to get a copy of this message
Note Submitter: Ivo van Sandick ---- Such a useful function, and only since version 5! Why an emulation for earlier PHP versions has not been posted long ago, is a mystery: <?php function array_combine_emulated( $keys, $vals ) { $keys = array_values( (array) $keys ); $vals = array_values( (array) $vals ); $n = max( count( $keys ), count( $vals ) ); $r = array(); for( $i=0; $i<$n; $i++ ) { $r[ $keys[ $i ] ] = $vals[ $i ]; } return $r; } ?>

« previous php.notes (#136365) next »