#32554 [Opn]: member variable initialization with heredoc

From: Date: Sun, 03 Apr 2005 11:06:37 +0000
Subject: #32554 [Opn]: member variable initialization with heredoc
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969367275@lists.php.net to get a copy of this message
ID: 32554 Updated by: sniper@php.net Reported By: 000005 at gmail dot com Status: Open -Bug Type: Scripting Engine problem +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 :) You can only put static scalars as the default value. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.doc (#969367275) next »