|
Posted by mootmail-googlegroups on 08/09/06 19:26
talthen.z-serwera.o2@nospam.pl wrote:
> 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
Well, I'm not sure if it is causing the specific error you mentioned,
but one of your problems is the line:
for ($x=0;$x<count($tresc);$x++)
In the array you gave as an example, you have some non-numeric key
values. Iterating a variable in order to do $tresc[$x] only works if
you have integer keys in order, such as
$tresc[0],$tresc[1],$tresc[2]...etc. For non-numeric keys, use the
foreach control structure.
Navigation:
[Reply to this message]
|