CodeIgniter Forums
problem with loading simplexml class - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: problem with loading simplexml class (/showthread.php?tid=31762)



problem with loading simplexml class - El Forum - 06-30-2010

[eluser]vindhyareddy[/eluser]
Hi folks

I am new to CodeIgniter as well as PHP.

I was working on the example on the following hyperlink:

Link

I am getting the required output.
But,

There is this error popping up along with the output.
Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 0

Filename: libraries/simplexml.php

Line Number: 229

The code which is throwing an error is :
Code:
226 function array_reindex($array)  
227    {  
228        if (is_array($array)) {  
229            if(count($array) == 1 && $array[0]){  
230                return $this->array_reindex($array[0]);  
231            }else{  
232                foreach($array as $keys => $items) {  
233                    if (is_array($items)) {  
234                        if (is_numeric($keys)) {  
235                            $array[$keys] = $this->array_reindex($items);  
236                        } else {  
237                            $array[$keys] = $this->array_reindex(array_merge(array(), $items));  
238                        }  
239                    }  
240                }  
241            }  
242        }  
243  
244        return $array;  
245    }

Can someone tell me what the problem is?

Thanks,
Vindhya


problem with loading simplexml class - El Forum - 06-30-2010

[eluser]WanWizard[/eluser]
The array you pass in the call to the array_reindex() function doesn't have a value with index '0'.


problem with loading simplexml class - El Forum - 06-30-2010

[eluser]vindhyareddy[/eluser]
So how do I make this work?? I mean how do i take dat error out?


problem with loading simplexml class - El Forum - 07-19-2010

[eluser]vindhyareddy[/eluser]
I came from a php 5.3 version to a php 5.2.x version to remove the error.
Problem solved!