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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
36 + 25 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Mar 28 13:01:28 2024 UTC