On 13 April 2011 19:04, Floyd Resler wrote:
> That didn't quite work. Here's what I did:
> $const=$argv[1];
> $value=email::$const;
>
> When I run it I get an "Access to undeclared static property" error.
>
> Thanks!
> Floyd
>
> On Apr 13, 2011, at 1:16 PM, Richard Quadling wrote:
>
>> On 13 Apri
David,
That worked great!
Thanks!
Floyd
On Apr 13, 2011, at 2:25 PM, David Harkness wrote:
> On Wed, Apr 13, 2011 at 11:04 AM, Floyd Resler wrote:
>
>> That didn't quite work. Here's what I did:
>> $const=$argv[1];
>> $value=email::$const;
>>
>
> Instead try this:
>
> $const = $argv
On Wed, Apr 13, 2011 at 11:04 AM, Floyd Resler wrote:
> That didn't quite work. Here's what I did:
> $const=$argv[1];
> $value=email::$const;
>
Instead try this:
$const = $argv[1];
$reflector = new ReflectionClass('email');
$value = $reflector->getConstant($const);
David
That didn't quite work. Here's what I did:
$const=$argv[1];
$value=email::$const;
When I run it I get an "Access to undeclared static property" error.
Thanks!
Floyd
On Apr 13, 2011, at 1:16 PM, Richard Quadling wrote:
> On 13 April 2011 17:45, Floyd Resler wrote:
>> I'm doing some testing fro
On 13 April 2011 17:45, Floyd Resler wrote:
> I'm doing some testing from the command line and would like to be able =
> to pass along a constant from a class. For example:
> php emailTest.,php OrderConfirmation
>
> OrderConfirmation is a constant in a class. Is there any way I can take =
> the
I'm doing some testing from the command line and would like to be able =
to pass along a constant from a class. For example:
php emailTest.,php OrderConfirmation
OrderConfirmation is a constant in a class. Is there any way I can take =
the value passed on the command line and have PHP figure out
Gary . wrote:
> On Mon, Apr 19, 2010 at 3:12 PM, Ashley Sheridan wrote:
>> On 19 April 2010 14:24, Gary wrote:
>
>>> Okay. Why not?
> ...
>> Class constants must be defined with static values, not variables. They are
>> constants after all! If they relied on the value of a variable, surely that
On Mon, Apr 19, 2010 at 7:25 AM, Peter Lind wrote:
> Per the PHP manual: "The value must be a constant expression". Is
> something that depends on other classes, variables or functions
> constant?
>
When I came up against this problem myself, I read "a constant expression"
to mean "an expression
On Mon, Apr 19, 2010 at 10:25 AM, Peter Lind wrote:
> On 19 April 2010 16:18, Gary . wrote:
> > On Mon, Apr 19, 2010 at 2:37 PM, Peter Lind
> wrote:
> >> On 19 April 2010 14:24, Gary wrote:
> >>> On Mon, Apr 19, 2010 at 10:36 AM, Peter Lind wrote:
> >
> So no, you shouldn't be able to do t
On 19 April 2010 16:18, Gary . wrote:
> On Mon, Apr 19, 2010 at 2:37 PM, Peter Lind wrote:
>> On 19 April 2010 14:24, Gary wrote:
>>> On Mon, Apr 19, 2010 at 10:36 AM, Peter Lind wrote:
>
So no, you shouldn't be able to do that.
>>>
>>> Okay. Why not?
>>
>> Hate to ask, but did you at any po
On Mon, Apr 19, 2010 at 3:12 PM, Ashley Sheridan wrote:
> On 19 April 2010 14:24, Gary wrote:
> > Okay. Why not?
...
> Class constants must be defined with static values, not variables. They are
> constants after all! If they relied on the value of a variable, surely that
> would mean that their
On Mon, Apr 19, 2010 at 2:37 PM, Peter Lind wrote:
> On 19 April 2010 14:24, Gary wrote:
>> On Mon, Apr 19, 2010 at 10:36 AM, Peter Lind wrote:
>>> So no, you shouldn't be able to do that.
>>
>> Okay. Why not?
>
> Hate to ask, but did you at any point consider to read the PHP docs on
> this? The
On Mon, 2010-04-19 at 14:37 +0200, Peter Lind wrote:
> On 19 April 2010 14:24, Gary . wrote:
> > On Mon, Apr 19, 2010 at 10:36 AM, Peter Lind wrote:
> >> On 19 April 2010 10:30, Gary wrote:
> >>> Should I be able to do this:
> >>>
> >>> class X
> >>> {
> >>> const FOO = 'foo';
> >>> const FOOBA
On 19 April 2010 14:24, Gary . wrote:
> On Mon, Apr 19, 2010 at 10:36 AM, Peter Lind wrote:
>> On 19 April 2010 10:30, Gary wrote:
>>> Should I be able to do this:
>>>
>>> class X
>>> {
>>> const FOO = 'foo';
>>> const FOOBAR = X::FOO . 'bar';
>>>
>>> ...
>>> }
>
>> So no, you shouldn't be able
On Mon, Apr 19, 2010 at 10:36 AM, Peter Lind wrote:
> On 19 April 2010 10:30, Gary wrote:
>> Should I be able to do this:
>>
>> class X
>> {
>> const FOO = 'foo';
>> const FOOBAR = X::FOO . 'bar';
>>
>> ...
>> }
> So no, you shouldn't be able to do that.
Okay. Why not?
--
PHP General Mailing L
On 19 April 2010 10:30, Gary . wrote:
> Should I be able to do this:
>
> class X
> {
> const FOO = 'foo';
> const FOOBAR = X::FOO . 'bar';
>
> ...
> }
>
> ?
>
> Because I can't. I get "syntax error, unexpected '.', expecting ',' or
> ';'". I assume this is because the constants are like statics
Should I be able to do this:
class X
{
const FOO = 'foo';
const FOOBAR = X::FOO . 'bar';
...
}
?
Because I can't. I get "syntax error, unexpected '.', expecting ',' or
';'". I assume this is because the constants are like statics which
can't be initialised by functions etc. but is there rea
getConstants());
?>
Thank you, I've try this above and works, I hadn't seen the message below.
Excuse my english.
On 3/7/06, Jared Williams < [EMAIL PROTECTED]> wrote:
> >
> >
> > Hi,
> >
> > ReflectionClass
> >
> > getConstant
> > getConstants
> > hasConstant
> >
> > http://www.ren.dotgeek.org
gt; getConstants
> hasConstant
>
> http://www.ren.dotgeek.org/classbrowser/class.php?class=ReflectionClass
>
> Jared
>
> > -Original Message-
> > From: Arnaldo Gandol [mailto:[EMAIL PROTECTED]
> > Sent: 07 March 2006 21:03
> > To: php-general@l
; Subject: [PHP] class constants
>
> how can I to iterate the class constant without knowing their
> names?, I've reviewed the Class/Object Functions and
> Reflexion and nothing, I dont want to use static class
> variables, can any one help.
>
--
PHP General Mailing Lis
Shaunak Kashyap wrote:
Constants aren't per class, they are per system. Whether you define
them
in a class or not won't change this.
You can list all constants using
http://www.php.net/manual/en/function.get-defined-constants.php
Actually, PHP5 allows constants per class, aka class cons
>
> Constants aren't per class, they are per system. Whether you define
them
> in a class or not won't change this.
>
> You can list all constants using
> http://www.php.net/manual/en/function.get-defined-constants.php
>
>
Actually, PHP5 allows constants per class, aka class constants. I think
Arnaldo Gandol wrote:
how can I to iterate the class constant without knowing their names?, I've
reviewed the Class/Object Functions and Reflexion and nothing, I dont want
to use static class variables, can any one help.
Constants aren't per class, they are per system. Whether you define them
how can I to iterate the class constant without knowing their names?, I've
reviewed the Class/Object Functions and Reflexion and nothing, I dont want
to use static class variables, can any one help.
Marcus Bointon wrote:
I'm not sure if this is a bug or a feature, but it seems you can't use
class constants to set default values for class properties. You can,
however, use them for default values for method params, e.g.:
class foo {}
^--- er.
const BAR = 100;
private $
I'm not sure if this is a bug or a feature, but it seems you can't
use class constants to set default values for class properties. You
can, however, use them for default values for method params, e.g.:
class foo {}
const BAR = 100;
private $thing = self::BAR;
function wibble($a = self::
26 matches
Mail list logo