note 110259 added to language.types.string
| From: | mcamiano at ncsu dot edu | Date: | Fri, 05 Oct 2012 14:43:56 +0000 |
| Subject: | note 110259 added to language.types.string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191148@lists.php.net to get a copy of this message | ||
Regarding the lack of complex expression interpolation, just assign an identity function to a
variable and call it:
function id($arg) { return $arg; }
$expr = id;
echo "Field is: {$expr( "1 ". ucfirst('whatzit')) }";
It is slower due to an additional function call, but it does avoid the assignment of a one-shot
temporary variable. When there are a lot of very simple value transformations made just for display
purposes, it can de-clutter code.
----
Server IP: 69.147.83.199
Probable Submitter: 152.14.95.61
----
Manual Page -- http://www.php.net/manual/en/language.types.string.php
Edit -- https://master.php.net/note/edit/110259
Del: integrated -- https://master.php.net/note/delete/110259/integrated
Del: useless -- https://master.php.net/note/delete/110259/useless
Del: bad code -- https://master.php.net/note/delete/110259/bad+code
Del: spam -- https://master.php.net/note/delete/110259/spam
Del: non-english -- https://master.php.net/note/delete/110259/non-english
Del: in docs -- https://master.php.net/note/delete/110259/in+docs
Del: other reasons-- https://master.php.net/note/delete/110259
Reject -- https://master.php.net/note/reject/110259
Search -- https://master.php.net/manage/user-notes.php