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

Posted by Norman Peelman on 11/04/07 22:18

Jerry Stuckle wrote:
> Rik Wasmus wrote:
>> On Fri, 02 Nov 2007 02:51:59 +0100, Jerry Stuckle
>> <jstucklex@attglobal.net> wrote:
>>
>>> Norman Peelman 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 can
>>>>> be done.
>>>>>
>>>>> int $tablename = 0;
>>>>>
>>>>> rather than
>>>>>
>>>>> var $tablename = 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?
>>>>>
>>>> You could name your variables to match the data you expect them
>>>> to hold, for instance:
>>>> $bTemp --> boolean
>>>> $sTemp --> string
>>>> $iTemp --> integer
>>>> $fTemp --> float
>>>> ...it may help you visually.
>>>> Norm
>>>>
>>>
>>> Which is Hungarian notation - and something most of us don't use in PHP.
>>>
>>
>> Hmm, maybe a deviation here, I see this more often then not..
>
> Hi, Rik,
>
> I see it very seldom on untyped languages such as PHP. It is, however,
> quite common in languages like C and PASCAL - although it seems to
> becoming less common there, also (IMHE, of course).
>

I never knew it had a specific name. I happened to notice it used in
scripting games like Unreal Tournament (which I know is C code and so
now it all makes sense).

Norm

 

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

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