Hello, [EMAIL PROTECTED]

    Seems, that multidimensional arrays are copied with one dimension,
which contains references to other included arrays.
I haven't found any references in manual, so this should be stated
somewhere and link provided on foreach page and maybe other functions,
which work with array copy. Perhaps I could do it myself, but I don't
feel so.
    Consider the following sample.
---
<?php

$a[0]['id']    = array(22, 12, 33, 55);
$a[0]['secid'] = array("a","b","c","d");

print_r($a);

$b = $a;

foreach ($b as $k => $v) {
    array_multisort($v['id'], SORT_DESC, $v['secid'], SORT_DESC);
}

print_r($a);
?>    
---

   I was surprised when I've found my $a sorted.
   Solution how to pass around this feature, since there's no
array_copy() function in PHP.

$b = unserialize( serialize( $a ) );
   
t
-- 
--[ http://wiki.phpdoc.info/DocLinks ]--

Reply via email to