ID: 46588 User updated by: vask at dmglobal dot net Reported By: vask at dmglobal dot net Status: Bogus Bug Type: Feature/Change Request Operating System: Any PHP Version: 5.2.6 New Comment:
Thanks for the reply and suggestions... However, HEREDOC/NOWDOC or maybe even a WHATEVERDOC would be more FLEXIBLE and INTUITIVE if the entire part inside was essentially treated as a separate file. Thus allowing: $sql = <<<SQL SELECT <?= get_it(); ?> LIMIT 1 SQL; The reason I though this would be possible is because unlike quoted strings NOWDOC/HEREDOC doesn't require you to escape quotations. Previous Comments: ------------------------------------------------------------------------ [2008-11-17 11:07:14] [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 Adding this is very likely to break many existing codes. Use this: $it = get_it(); $sql = <<<SQL SELECT $it LIMIT 1 SQL; Maybe you can also fake a property that will actually call a method (with an object using __get()): $sql = <<<SQL SELECT $object->get_it LIMIT 1 SQL; ------------------------------------------------------------------------ [2008-11-17 03:23:17] vask at dmglobal dot net Description: ------------ NOWDOC/HEREDOC only allows PHP values such as those allowed within a quoted string. Permitting PHP code (such as functions) within NOWDOC/HEREDOC will allow more flexibility for coding. Also, when using a text editor, syntax styling for PHP and syntax styling for another language specified by the NOWDOC/HEREDOC within the same file would be more readable as breaking apart the NOWDOC/HEREDOC for a function call would no longer be necessary. In the below examples I would like to reemphasize the importance of: - PHP code with PHP syntax styling - SQL code with SQL syntax styling $sql = <<<SQL SELECT <?= get_it(); ?> LIMIT 1 SQL; Instead of: $sql = <<<SQL SELECT SQL; $sql .= get_it(); $sql .= <<<SQL LIMIT 1 SQL; Reproduce code: --------------- $sql = <<<SQL SELECT <?= get_it(); ?> LIMIT 1 SQL; Expected result: ---------------- $sql = <<<SQL SELECT <?= get_it(); ?> LIMIT 1 SQL; Actual result: -------------- Does NOT run. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46588&edit=1