|
Posted by Jerry Stuckle on 11/01/07 12:20
Philluminati 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 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?
>> 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? 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?
>
>
I comment the code as necessary - but I use /* ... */ and // - PHP
doesn't recognize # as a comment delimiter.
And no, I don't have to search through multiple files. My variables
aren't found in more than one file. I structure my code.
And in any case, sometimes my code might contain false, while at other
times it might contain -1 or 0. And they would have different meanings.
For instance, a database request might return a resource object or false
- depending on whether the request was set or not.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|