ID: 32554
User updated by: 000005 at gmail dot com
Reported By: 000005 at gmail dot com
Status: Open
Bug Type: Documentation problem
Operating System: Linux 2.6/Gentoo
PHP Version: 4CVS,5CVS (2005-04-03)
New Comment:
> This is not really PHP bug but just
> missing documentation. (or I just couldn't
> find the place where it's documented :)
I couldn't find where this is documented either.
> You can only put static scalars as the
> default value.
I am able to initialize member variables with strings using single or
double quotes. Is a string a scalar?
Mainly, is there a way to initialize a member variable with a
multi-line string? I think there should be.
Thanks
Previous Comments:
------------------------------------------------------------------------
[2005-04-03 13:06:36] [EMAIL PROTECTED]
This is not really PHP bug but just missing documentation.
(or I just couldn't find the place where it's documented :)
You can only put static scalars as the default value.
------------------------------------------------------------------------
[2005-04-03 07:12:40] 000005 at gmail dot com
Description:
------------
Trying to initialize a member variable using heredoc
notation produces a compiler error:
Parse error: parse error, unexpected T_START_HEREDOC in
/.../foo.php on line 6
Reproduce code:
---------------
<?
class foo
{
public $bar = <<<END
blah blah blah
END;
}
?>
Expected result:
----------------
The member variable $bar to be assigned "blah blah
blah".
Actual result:
--------------
Parse error: parse error, unexpected T_START_HEREDOC in
/.../foo.php on line 6
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32554&edit=1