You are here: Re: Static method to get class variable (PHP4) « All PHP « IT news, forums, messages
Re: Static method to get class variable (PHP4)

Posted by Sjoerd on 05/31/06 14:25

Markus Ernst wrote:
> In order to make static class variables accessible in a clean way I try
> to write a method in the base class, as shown in this example:

You probably mean private/protected instead of static.

> <?php
> class childclass
> {
> var $types = array('text', 'password', 'hidden');
> function get_types() {
> return $types;
> }
> }
>
> print_r(childclass::get_types());
> ?>

The variable $types does not exist until an instance of this class is
made:

$foo = new childclass();
$foo->get_types();

 

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

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