Re: Class Constants
| From: | Richard Quadling | Date: | Wed, 13 Apr 2011 17:16:31 +0000 |
| Subject: | Re: Class Constants | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-312371@lists.php.net to get a copy of this message | ||
On 13 April 2011 17:45, Floyd Resler <fresler@adex-intl.com> 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 value passed on the command line and have PHP figure out which =
> constant is equals?
>
> Thanks!
> Floyd
In your script ...
<?php
print_r($argv); // Requires ini setting to set argv and argc.
// or
print_r($GLOBALS['argv']); //
?>
Once you've got the value, you can ...
$s_ConstantValue = className::$s_ConstantNameFromCommandLine;
sort of thing.
--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY