| 
	
 | 
 Posted by <talthen.z-serwera.o2 on 08/09/06 16:01 
Hello, 
I have an array like this: 
 
Array 
( 
    [0] => Array 
        ( 
            [1] => Array 
                ( 
                    [ID] => 7A585DC0 
                    [Co] => Array 
                        ( 
                            [C] => nat 
                            [b] => 7A585DC0 
                        ) 
 
                    [T] => Array 
                        ( 
                            [1] => Array 
                                ( 
                                    [ID] =>7A585DC0 
 
I want to delete some items from it. I think I have to do it recursively,  
but PHP says: 
"Fatal error: Only variables can be passed by reference in c:\www\p.php on  
line 51" 
 
The function looks like this: 
 
function Del(&$tresc) 
{ 
if (is_array($tresc['T'])) Del($tresc['T']); 
else if (!$tresc['T']) 
 { 
 for ($x=0;$x<count($tresc);$x++) 
  { 
  Del($tresc[$x]); //THIS IS LINE 51 
  } 
 } 
else if (($tresc['Co']['C']=='hl') and 
         (!$tresc['Co']['n'])) 
         array_splice($tresc,0,1); 
} 
 
How to iterate through all elements and delete some of them? 
 
Regards, 
Talthen
 
  
Navigation:
[Reply to this message] 
 |