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 09:59

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'];
> }
>
> }

Ummm. Forigve the dim question. I have a lot of functions in this class. I
wouldn't need to declare them inside each function would I?

Big gulp.

If that was the case it would be easier to just do as I currently do and
define the variables inside the class explicitly. Which works beautifully,
but I'm trying to make my code as streamlined and centralised as possible,
mainly do to my own ineptness making me worry I'll lose track.

 

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

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