|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-01-05 13:48 UTC] tularis@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Mar 19 17:00:01 2026 UTC |
I'm relatively new to PHP. Previously I used to program a lot in Perl. What I really lack in PHP is Perl's ability to interpolate any expression inside a string. For example: Perl: "Next value is @{[ $value + 1 ]}!" PHP: "Next value is " . $value + 1 . "!" In this simple case it's not a great problem, but it becomes more awkward when using the heredoc operator. In this cases I'm often forced to use temporary variables: $tempvar = $value + 1; print <<< END Here it is the next value $tempvar Other text... END; I propose to extend the Variable Parsing syntax to evaluate ANY expression instead of variables only. I propose the following syntax: print <<< END Here it is the next value {$= $value + 1 } Other text... END; Using "{=" would be more readable but it would cause too many backward compatibility problems... What do you think of this? Thanks.