Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #3470

declaring private variable in class

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From DavidB <davidbrotman2768@gmail.com>
Newsgroups comp.lang.php
Subject declaring private variable in class
Date Thu, 20 Oct 2011 13:56:30 -0700 (PDT)
Organization http://groups.google.com
Lines 10
Message-ID <6133623.1088.1319144190478.JavaMail.geo-discussion-forums@prfp13> (permalink)
Reply-To comp.lang.php@googlegroups.com
NNTP-Posting-Host 67.164.218.32
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
X-Trace posting.google.com 1319144534 18213 127.0.0.1 (20 Oct 2011 21:02:14 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Thu, 20 Oct 2011 21:02:14 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=67.164.218.32; posting-account=J5yt5goAAAD4Nnk7VN63Nb32HgJhGjMP
User-Agent G2/1.0
X-Google-Web-Client true
Xref x330-a1.tempe.blueboxinc.net comp.lang.php:3470

Show key headers only | View raw


Hi:

I created a class and then declared a private variable called today and set it = to today's date:

class someclass
{
private $today = date("Y-m-d");
}

For some reason, it doesn't like it. There is an error message about the parenthesis. Am I not allowed to set a variable = to some function like date or whatever? It didn't complain when I set it = to some string constant like "2011-10-10".

Back to comp.lang.php | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

declaring private variable in class DavidB <davidbrotman2768@gmail.com> - 2011-10-20 13:56 -0700
  Re: declaring private variable in class Gregor Kofler <usenet@gregorkofler.com> - 2011-10-20 23:20 +0200
    Re: declaring private variable in class Robert Heller <heller@deepsoft.com> - 2011-10-20 17:29 -0500

csiph-web