You are here: Re: undefined array index question « PHP Programming Language « IT news, forums, messages
Re: undefined array index question

Posted by petermichaux on 09/17/05 22:07

Oops. I have figured out how to test this problem with error-reporting
enabled.

However it looks like I over simplified my problem and my question
still remains. Here is an improved version of my question. In the
following code there are no errors reported. However, if I uncomment
the one comment then I will get an error "Undefined index: bar ".

Any ideas why I can use the undefined index 'bar' in $this->mArray as
long as $this->mArray has never been initiated/used?

Thanks again,
Peter

class MyClass
{
private $mArray;

public function PrintArrayElement()
{
//$this->mArray['foo']=3;
echo $this->mArray['bar'];
}
}

$my_class = new MyClass;
$my_class->PrintArrayElement();

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация