Edit report at http://bugs.php.net/bug.php?id=38098&edit=1
ID: 38098 Comment by: nicolas dot hureau at kwift dot com Reported by: wiart at yahoo dot com Summary: String concatenation Status: Bogus Type: Bug Package: Unknown/Other Function Operating System: Linux (Fedora core 4) - AMD64 PHP Version: 5.1.4 New Comment: Actually, operations are not permitted while declaring properties or class constants, and that is quite annoying. For example: public $two = 1 + 1; or const two = 1 + 1; or public static $two = 1 + 1; won't compile. Previous Comments: ------------------------------------------------------------------------ [2006-07-13 15:15:19] [email protected] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php ------------------------------------------------------------------------ [2006-07-13 15:12:52] wiart at yahoo dot com Description: ------------ reproduced with PHP 5.1.2 (sorry, no time to test with 5.1.4). Impossible to concatenate strings in a class member declaration, it generates a PHP "Parse error". Very annoying when, for example, one want to create a member string which is a concatenation of a text and a constant Reproduce code: --------------- <?php class MyClass { public $myString = 'test1'.'test2'; } $myClass = new MyClass(); echo "Result is: ".$myClass->myString; ?> Expected result: ---------------- Result is: test1test2 Actual result: -------------- Parse error: parse error, unexpected '.', expecting ')' in /home/wiart/genomequest/apache/web/GQ/lib/comparisonNew/HTMLlaunchform.php on line 5 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=38098&edit=1
