note 42565 added to function.array-combine

From: Date: Fri, 21 May 2004 14:07:44 +0000
Subject: note 42565 added to function.array-combine
Groups: php.notes 
Request: Send a blank email to php-notes+get-69908@lists.php.net to get a copy of this message
<?php function _array_combine( $keys, $vals ) { if(!$keys){ foreach( $vals as $v ){ $buf[].=$v; } return $buf; } return array_combine( $keys, $vals ); } $keys=array( 'one','two','three','four','five' ); $vals=array( 1,2,3,4,5 ); /** passes to php function **/ print_r( _array_combine( $keys, $vals ) ); /** equivilent to array_combine( array(0,1,2,3,4), $vals) This allows re-indexing of arrays after calls to eg: array_filter **/ print_r( _array_combine( false, $vals ) ); ?> ---- Manual Page -- http://www.php.net/manual/en/function.array-combine.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+42565 Delete -- http://master.php.net/manage/user-notes.php?action=delete+42565&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+42565&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#69908) next »