| 
	
 | 
 Posted by Ivo on 09/02/05 16:07 
Hello newsgroup, 
A Note that I just posted in the PHP manual at the page describing 
the array_combine() function: 
<URL: http://www.php.net/array-combine#56424 > 
contains this code: 
 
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; 
} 
 
I did take great care as it was my first ever contribution to the User 
Contributed Notes, but still a nasty mistake slipped in: instead of the use 
of the function max() in the example code given, there should of course have 
been either a call to min(), or some padding mechanism for the shorter 
array. It 's too embarrassing to add another note about, so for the record I 
figured this newsgroup might be more appropriate. 
Must be the thrill of contributing, 
ivo 
http://4umi.com/web/
 
  
Navigation:
[Reply to this message] 
 |