On Tue, Jun 18, 2002 at 07:21:51PM +0200, Jens Lehmann wrote:
>
> class test
> {
> var $a = 2*10;
> }
>
> Of course I know why there's a parse error, but I don't
> know the reason why PHP doesn't allow this multiplication,
Because, that's why. :)
--Dan
--
PHP classes that
Can anyone explain me why the following code causes
the parse error "... unexpected * ... " ?
class test
{
var $a = 2*10;
}
Of course I know why there's a parse error, but I don't
know the reason why PHP doesn't allow this multiplication,
although it allows a statement like e.g. var $a = 20.
> > its really a big headache with compilers like c bugging all the way just for
>declarations.
One remark, btw. Using explicit declarations isn't really more of a
headache then _not_ using expl.decl. When you don't
use explicit declarations, you'll need to check wether or not a
variable is defi
From: sagar N Chand <[EMAIL PROTECTED]>
Date: Thu, Sep 27, 2001 at 06:01:26PM +0530
Message-ID: <005101c14750$c3189b10$0101a8c0@inferno>
Subject: Re: [PHP] Variable declaration
> its really a big headache with compilers like c bugging all the way just for
>declarations.
&g
Cc: [EMAIL PROTECTED]
Sent: Thursday, September 27, 2001 2:02 PM
Subject: Re: [PHP] Variable declaration
> That is the nature of a loosely typed scripting language.
I know.
> If you prefer a strongly typed compiled language, there are plenty
> of those available.
I
> That is the nature of a loosely typed scripting language.
I know.
> If you prefer a strongly typed compiled language, there are plenty
> of those available.
I know to. But those are not as powerful for building websites as
PHP. I mean... don't get me wrong here, I think PHP is great (or
even
That is the nature of a loosely typed scripting language. If you prefer a
strongly typed compiled language, there are plenty of those available.
-Rasmus
On Thu, 27 Sep 2001, * R&zE: wrote:
> > Like I said, that line does both. It sets the type internally to an
> > integer and assigns the valu
> Like I said, that line does both. It sets the type internally to an
> integer and assigns the value.
>
> -Rasmus
What he (Alberto) is looking for, and what I would prefer to, is to
really explicitly declare a variable. There's a difference between a
compiler that requires you to declare (inte
> > What do you mean force declaration? That's what you are doing with this
> > line:
> >
> > $Test = 3;
>
> Nop! This is just starting to use a variable. Something like:
>
>integer $Test;
>
> is declaring a variable. But FAFAIK it's not possible in PHP :(
Like I said, that line does both.
> What do you mean force declaration? That's what you are doing with this
> line:
>
> $Test = 3;
Nop! This is just starting to use a variable. Something like:
integer $Test;
is declaring a variable. But FAFAIK it's not possible in PHP :(
--
* R&zE:
--
-- Ren
On Thu, 27 Sep 2001, it was written:
> $Test=3;
> echo $Test;
> ?>
>
> And I get no warning about $Test not being declared before (like C
> declaration).
>
> Any1 has an example about forcing variable declaration?
What do you mean force declaration? That's what you are doing with this
line:
And I get no warning about $Test not being declared before (like C
declaration).
Any1 has an example about forcing variable declaration?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact
> I want PHP parser to warn/fail when I try to use a variable
> not declared before. Like "Option Explicit" on ASP/VBA.
Look here:
http://www.php.net/manual/en/function.error-reporting.php
Chris
I want PHP parser to warn/fail when I try to use a variable not declared
before. Like "Option Explicit" on ASP/VBA.
Thnx in advance :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the
14 matches
Mail list logo