Bug #10506: Using a variable as a mathematical operator
| From: | jdj at darkside dot dynup dot net | Date: | Thu, 26 Apr 2001 09:06:01 +0000 |
| Subject: | Bug #10506: Using a variable as a mathematical operator | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-52477@lists.php.net to get a copy of this message | ||
From: jdj@darkside.dynup.net
Operating system: Linux, but not important
PHP version: 4.0.4pl1
PHP Bug Type: Feature/Change Request
Bug description: Using a variable as a mathematical operator
I am parsing the Date: header of an email address, which includes a GMT offset in the form [+|-]%4d.
Ideally, one of the following would work. ;)
$hour_mins = '0600';
$gmt_offset = '+0200';
$hour_mins = $hour_mins $gmt_offset[0] substr ($gmt_offset, 1);
That returns a parse error.. as does the short form of that (+=).
As it is now, I'm switch()'ing the $gmt_offset[0].
$hour_mins += substr ($gmt_offset, 1); works..
$hour_mins = $hour_mins + substr ($gmt_offset, 1); works..
Is this unsupported for any particular reason.. or am I just not syntactically correct?
Thanks!
Jeremy
--
Edit Bug report at: http://bugs.php.net/?id=10506&edit=1