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


Groups > comp.lang.php > #3470

declaring private variable in class

From DavidB <davidbrotman2768@gmail.com>
Newsgroups comp.lang.php
Subject declaring private variable in class
Date 2011-10-20 13:56 -0700
Organization http://groups.google.com
Message-ID <6133623.1088.1319144190478.JavaMail.geo-discussion-forums@prfp13> (permalink)

Show all headers | 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