Array_merge, safety and race condition?

From: Date: Fri, 11 Nov 2005 17:29:00 +0000
Subject: Array_merge, safety and race condition?
Groups: php.internals 
Request: Send a blank email to internals+get-19967@lists.php.net to get a copy of this message
I sent this to the general list, but I didn't get definitive answer. Maybe internals is the better forum to talk about it. If you have a test code, or other pointers towards a definitive answer, I'd love to try it. Thanks Php experts everywhere, I want to merge two arrays, and I want to store the result as the first array. Something like the following: $array1 = array_merge ($array1, $array2); So far the code gives me what I want. However, suppose if $array1 is extremely huge, am I introducing a bug here because of possible race condition? It's possible that array_merge has two write something to $array1 (left hand side) before it even finishes reading it (argument) in the first place. Let alone merging the two. Should I just go conservative and do: $tmp = array_merge($array1, $array2); $array1 = $tmp; Thank you, Ezra

« previous php.internals (#19967) next »