ID: 26448 User updated by: hervecaussinus at yahoo dot ca Reported By: hervecaussinus at yahoo dot ca -Status: Bogus +Status: Closed Bug Type: Zend Engine 2 problem Operating System: Windows 2000 PHP Version: 5.0.0b2 (beta2) New Comment:
Thank you. I will test this again in my office. Previous Comments: ------------------------------------------------------------------------ [2004-02-03 15:15:45] redeye at erisx dot de Remove the Backslashes ( your string wasn't enclosed ) <?php class MyClass { public $Hello = "Hello, World\n"; } print 1; ?> ------------------------------------------------------------------------ [2003-11-28 12:01:07] hervecaussinus at yahoo dot ca I test the syntax: <?php class MyClass { public $Hello = \"Hello, World\\n\"; } print 1; ?> and it does not work. Once again I am very sorry if I am doing something wrong (that is possible due to my short experience) but I think it is a bug (that looks strange I must admit). ------------------------------------------------------------------------ [2003-11-28 11:31:21] [EMAIL PROTECTED] Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. You need to define class variables like this: class MyClass { public $Hello = \"Hello, World\\n\"; } no bug here. ------------------------------------------------------------------------ [2003-11-28 10:54:47] hervecaussinus at yahoo dot ca Description: ------------ I am not able to use the class examples in your Web site. In fact it seems that it is impossible to declare a variable when defining a class. I am very new to PHP (3 days). Sorry if I am doing something wrong. I look at the bug database and I also download and install the last binary (php5-win32-200311281530.zip). Reproduce code: --------------- <?php class MyClass { $Hello = "Hello, World!\n"; } print 1; ?> Expected result: ---------------- Should parse and display 1 . Actual result: -------------- Gives this error: Parse error: parse error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in c:\inetpub\wwwroot\CorePHP\6-1.php on line 3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26448&edit=1