You are here: Re: Define variables with a type « PHP Programming Language « IT news, forums, messages
Re: Define variables with a type

Posted by Rik Wasmus on 11/01/07 14:48

On Thu, 01 Nov 2007 13:15:13 +0100, Philluminati =

<Phillip.Ross.Taylor@gmail.com> wrote:

> On Nov 1, 12:11 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> Philluminati wrote:
>> > I've been looking on the Internet and I can't seem to see any one
>> > specifying a variable with a type. Will someone please tell me it c=
an
>> > be done.
>>
>> > int $tablename =3D 0;
>>
>> > rather than
>>
>> > var $tablename =3D 0;
>>
>> > Is it possible?
>>
>> > If not, do you all go back to using hungarian notation in order to
>> > know what data types your working so you don't accidently set false=

>> > and true against a flag which is supposed to 0 and -1?
>>
>> No, PHP variables are untyped.
>>
>> And no, I don't use Hungarian notation. Rather, I document the code.=

>>
>
> How do you document the code if I may ask? with #comments around the
> variable? Do you then have to go traipsing through the .php files to
> find it's original meaning?

Normally, I use phpDocumentor.... Comments inline, generate documentatio=
n =

from them on changes. http://www.phpdoc.org

> I think this was the original reason for
> Hungarian notation. Now I might just be dinosaur but is it much of a
> problem or do you learn to get along fine without types?

PHP's advantage and disadvantage is variable types. One learns to deal =

with it with either loose matching, or casting/strict comparisons. In =

class methods starting with PHP 5 you can specify an argument has to be =
=

(derived from) a particular object, that's about it.
-- =

Rik Wasmus

 

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

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