note 82638 modified in ref.xml by felipe

From: Date: Sun, 20 Apr 2008 11:41:00 +0000
Subject: note 82638 modified in ref.xml by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-138566@lists.php.net to get a copy of this message
I used shawn's code that is an ongoing fix/update of a very nice php 4 & 5 compatible class. It works great, only it kept giving me errors when the array isn't set, (I have errors set to show all). <?php // Here is the old function that gave errors: function makeChildNode() { if (!is_array($this->pointer['child_nodes'])){ $this->pointer['child_nodes'] = array(); } return count($this->pointer['child_nodes']); } // Here is the new function that does not spit errors: function makeChildNode() { if (!isset($this->pointer['child_nodes'])){ $this->pointer['child_nodes'] = array(); } return count($this->pointer['child_nodes']); } ?> --was-- I used shawn's code that is an ongoing fix/update of a very nice php 4 & 5 compatible class. It works great, only it kept giving me errors when the array isn't set, (I have errors set to show all). <?php Here is the old function that gave errors: function makeChildNode() { if (!is_array($this->pointer['child_nodes'])){ $this->pointer['child_nodes'] = array(); } return count($this->pointer['child_nodes']); } Here is the new function that does not spit errors: function makeChildNode() { if (!isset($this->pointer['child_nodes'])){ $this->pointer['child_nodes'] = array(); } return count($this->pointer['child_nodes']); } ?> http://php.net/manual/en/ref.xml.php

« previous php.notes (#138566) next »