note 56424 added to function.array-combine

From: Date: Fri, 02 Sep 2005 08:04:39 +0000
Subject: note 56424 added to function.array-combine
Groups: php.notes 
Request: Send a blank email to php-notes+get-94638@lists.php.net to get a copy of this message
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; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.array-combine.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56424 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56424&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56424&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56424&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56424&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56424&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56424&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56424&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#94638) next »