Re:
| From: | Greg Donald | Date: | Sun, 10 Oct 2004 11:44:36 +0000 |
| Subject: | Re: | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-199104@lists.php.net to get a copy of this message | ||
On Sat, 9 Oct 2004 21:29:55 -0500, php-list@xenonsolutions.com
<php-list@xenonsolutions.com> wrote:
> Notice: Undefined variable: children in
> L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line
> 58
>
> This error occurs only when the class's method outputs $children as having a
> value of zero. Below is the class. I want it to return zero but I don't want
> this error. Do I need to change my error settings in my php.ini file? The
> error level is currently set to E_ALL and I'm using PHP 5.0.1. If at all
> possible, I want to keep this error setting at high because I want
> everything to be coded strictly. What did I do wrong in my class and how can
> I fix it to where it doesn't output an error when a class's method returns a
> value of zero? Here's the class:
>
> function get_children($parent) {
$children = array();
> $parent_coord = tree::get_item_coord($parent);
> $descendants = $this->get_descendants($parent);
> for ($i = 0; $i < count($descendants); $i++) {
> if ((empty($children)) && (($parent_coord['0']['lft'] +
> 1) ==
> $descendants[$i]['lft'])) {
> $children[] = $descendants[$i]; // found first child
> }
> elseif (($children[count($children)-1]['rgt'] + 1 ==
> $descendants[$i]['lft']) && $children[count($children)-1]['rgt'] +
> 1 !=
> $parent_coord['0']['rgt']) {
> $children[] = $descendants[$i]; // find next children
> }
> }
> return $children;
> }
>
> Thanks in advance to anyone that can explain this error to me.
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/