You are here: Re: Creating a class and reusing variables... « PHP SQL « IT news, forums, messages
Re: Creating a class and reusing variables...

Posted by Bonge Boo! on 05/26/05 12:06

On 26/5/05 7:53 am, in article Gnele.1486038$8l.366880@pd7tw1no, "Paul"
<freelance@dezignage.net> wrote:

>> So if anyone can point the way to getting variables into a class from
>> "outside" I would appreciate it.
>>
> sorry just a quick note I caught myself on...
>
> inside the object you'd have to declare the variable... like so..
>
> class Cart {
> var $var;
>
> function Cart() {
> $this->var =& $GLOBALS['var'];
> }
>
> }
>
> for php 5 you can use its "native" constructor __Construct() instead of
> the shown example... which is for PHP < 5 :)


Ok. Just found

http://docs.php.net/en/language.oop.html

Which explains the above quite nicely. So it looks like major re-write time.
Dunno if I can be bothered at this stage (which will almost certainly come
back and bit me in the ass)

Thanks for your thoughts.

 

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

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