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_e mulated( $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/ 2 4366
On Fri, 02 Sep 2005 15:07:44 +0200, Ivo wrote: Hello newsgroup, A Note that I just posted in the PHP manual at the page describing the array_combine() function:
<snip> 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/
I imagine many more people read the online manual than read this group
though. Can't see why you'd be too embarrased (everyone makes mistakes),
but surely it would be less embarrasing to post your own correction
there before someone else does :)
--
Dave <da**@REMOVEbun dook.com>
(Remove REMOVE for email address)
Ivo wrote: 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_e mulated( $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/
Don't worry man. :-)
You ARE contributing, so you are OK.
The good news: Sometimes, when some php.net-maintainer has time for it, they
scan through the contributions and clear them up a bit. Happened to some of
my 'great remarks' on php.net. ;-)
So: Just repost your improved code, with a remark that the original was
wrong, and eventually your original posting will be deleted.
Best wishes and good weekend.
Regards,
Erwin Moller This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dave Smithz |
last post by:
Hi there.
Because of the lack of a Union query in MySQL 3 I have decided to take the
approach where I populate two arrays with values from similar tables in DB.
In this case they are `courses` and `lessons`
Lets say Courses has fields
CourseID(PK), Date, Name, RunBy, Status
The lessons table is related to the Courses table in that a Course can have
|
by: kee |
last post by:
Hi All,
I am trying to figure out on how to combine 2 byte array and save to a file.
e.g.
open "image001.bmp" for binary access write as #1
put #1,,x() & y()
close #1
notes : x() and y() contains bitmap binary data.
|
by: vmsgman |
last post by:
Here is a code sample ...
int blah = ReadFile( defArray, defFileName, w, h);
// Read File Contents into memory array and return for processing
public int ReadFile( ref ushort nArray, string sFname, int w, int h)
{
FileStream fs = new FileStream(sFname, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
// Read data
|
by: vladislavf |
last post by:
Hi All,
I need to pass array of strings from C++/CLI to unmanaged C++ function.
(The unmanaged API signatire is : int Combine(int NumOfInputFiles,
wchar_t **names) and I want to call it from C++/CLI code by using C++
Interop )
But unfortunately I have only one day experience in C++/CLI so all my
attempts are failing.
|
by: farseer |
last post by:
i am getting "error C2057: expected constant expression" with the
following code:
ifstream f( argv );
f.seekg( 0, ios::end );
const long fSize = f.tellg();
f.close();
char content;
| |
by: Peter Hallett |
last post by:
I would like to set up a string array as a class member, or field, and then
populate this array by reading in from a text file, but I cannot find the
appropriate syntax. The getter and setter are very unhappy with the idea and
the compiler refuses to play ball with any of the attempts I have made to
build such a structure. There is no problem when using a single string but a
two dimensional array of strings appears to be a very different...
|
by: Miles |
last post by:
Hi all,
Wondering if anyone can help me. If i have an associative array:
$arr = array(
"one" =array(1, 2, 3),
"two" =array(5, 6),
"three" =array(7,8,9,10)
....
"n" =array(p,q,r....)
|
by: nico3334 |
last post by:
Hi, I have 2 arrays (Each As a String), and I would like to combine these into a new single array. Is there an easy way of coding this? For example, I want "arrData" and "arrID" to be combined into a new array: "arrTotal". If anyone could give me some coding examples, I'd greatly appreciate it. Thanks!
|
by: macca |
last post by:
Hi,
I'm doing an two ldap_search queries and I need to combine the two
results into one single array containing all the results from each but
removing duplicates.
I have tried built in php functions such as array_merge (which gives
me duplicates) and array_unique which does not work either.
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |