How to copy an array?


Back to questions answers.


*phparray    (2009-10-29)
How to copy an array?

Hello, I would like to copy an array in PHP but it seems to me that there is a problem with this function, in example: $tab1 = $tab2;

I am a beginner but obviously it does not really copy the array, only the keys or something like that. Consequently if you modify the first array, the second is modified too.

Finally my question is : What is the correct function to clone an array in PHP?

Thanks a lot.



(more options below)

See also


ficgs
More websites

You must register to see these links, as this is a collaborative page, then you may change the order of the links by clicking the icons before the titles.



admin
Other websites

The following links might be less relevant, please change their ranks if you find them useful.


  * - A Java Code Example
javadb
  1. The method takes five parameters: source, source start position,
  2. In this example we create an array of integers with ten values and
 Brian Huisman - How to copy arrays and objects in Javascript
my.opera > GreyWyvern/blog/s

that value, while assigning an array or an object to a variable...
The slice(0) method means, return a slice of the array from element...

 Copy an array with Array.Copy at C# Online.NET (CSharp-Online.NET)
en.csharp online > Copy an array with Array.Copy

integers array elements: 5 10 15 doubles array elements: 5 10...

 Copy byte array to other - C# / C Sharp answers
bytes > topic/c sharp/answers/720574 copy byte array other

I think I read somewhere (or maybe here in an older post) that...
SushiSean, You would use the static BlockCopy...

 Perl array copy example - * in Perl | devdaily.com
devdaily > perl/perl array copy array in perl

Perl string array - How to create and use an array of...
When ripping a DVD to a digital movie file makes...
UML Use Case quality - Questions to ask yourself when writing a Use...

 Java Tips - * into another
java tips > java se tips/java.lang

0) { //change the following line to true to submit form return...
0)) { mozWrap(txtarea, bbtags[bbnumber],...
A game of Tic-Tac-Toe that can be played between two client...

  * in PHP?
experts exchange > Web Development/Web Languages Standards/PHP/Q 23300497

Subscribe now for full access to Experts Exchange and...
All Experts Exchange premium technology solutions are available to...

 MATLAB Central - Newsreader - * into a subarray
mathworks > matlabcentral/newsreader/view thread/256603

 JavaScript arrays: copying, transferring and merging
devarticles > c/a/JavaScript/JavaScript arrays copying transferring and merging

Comments On: JavaScript arrays: copying, transferring and...
Next: How to copy the elements of one array into another using...

 How to Copy an Excel range into an array - Visual Basic 4 / 5 / 6
daniweb > forums/thread94152

No one has posted to this discussion for at least three...

 Java Examples - How do I copy char array to string?
kodejava > examples/177

How do I get operating system temporary directory /...
Creative Commons Attribution-Noncommercial-Share Alike...



Response  
 

Guest name   (option)     Register
Please sum : 6877 + seven  



كيف أن ينسخ صف?    (ar)
Как да копие на Цветоотделителен    (bg)
Jak kopie celé škále?    (cs)
Hvordan at kopiere en række?    (da)
Wie man eine Reihe kopiert?    (de)
Πώς να αντιγράψει μια σειρά;    (el)
¿Cómo copiar un arsenal?    (es)
چگونه يك نسخه از يك تركيب?    (fa)
Miten jäljennös kirjo on?    (fi)
Comment copier une rangée ?    (fr)
Yadda kwafin wani sashi?    (ha)
איך עתק במהלך מערך?    (he)
किस प्रकार की नकल करने    (hi)
Hogyan példányt tömb?    (hu)
Come copiare un allineamento?    (it)
配列をコピーする方法か。    (ja)
배열을 베끼는 방법?    (ko)
Hoe te om een serie te kopiëren?    (nl)
Hvordan å kopiere en fylking?    (no)
Jak szeroki wachlarz egzemplarz?    (pl)
Como copí uma disposição?    (pt)
Cum sa copie o gama?    (ro)
Как скопировать блок?    (ru)
Kako da se kopiraju čitav niz?    (sr)
Hur man kopierar en samling?    (sv)
ว่าจะคัดลอกอาเรย์หรื    (th)
Nasıl kopya köklü?    (tr)
ایک پرابندی کیسے کاپی ہے?    (ur)
如何复制列阵?    (zh)




Trackbacks : If you talked about this article in your blog or website, you may instantly get a backlink 
There's no trackback at the moment.