You are here: SOLVED: Global class instances mysteriously set to NULL « PHP « IT news, forums, messages
SOLVED: Global class instances mysteriously set to NULL

Posted by James on 10/04/16 11:05

I *really* appreciate everybody's previous input. I may be a highly
experienced programmer, but am relatively new to PHP.

OK, I figured out what was going on. Google enough and read enough and
the light goes on finally.

The problem was not the "require_once" but a scoping problem.
Specifically, I was calling "require_once" /from within a function/.

Bad! Bad! Bad!

The included source file was also including other files... thus the
global class instance was just fine... it was simply hidden due to
scoping rules.

Yikes! I was really pulling my hair out when entire global functions
were "disappearing" due to the screwed up scope.

I finally figured out the problem in the "User Contributed Notes"
section of the PHP manual (http://www.php.net/language.variables.scope).

THANK YOU again...

 

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

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