php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #10506 Using a variable as a mathematical operator
Submitted: 2001-04-26 05:06 UTC Modified: 2001-04-26 05:14 UTC
From: jdj at darkside dot dynup dot net Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.0.4pl1 OS: Linux, but not important
Private report: No CVE-ID: None
 [2001-04-26 05:06 UTC] jdj at darkside dot dynup dot net

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-26 05:14 UTC] cynic@php.net
just not correct.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Oct 30 22:01:28 2024 UTC