[PHP-NOTES] note 130596 added to language.types.string
| Newsgroups | php.notes |
|---|---|
| Message-ID | <[email protected]> |
<?php
/*
* PHP 8.5+: You can interpolate arbitrary expressions in double-quoted strings and heredoc,
* including method calls with arguments.
*/
class C
{
public function say(string $s): string
{
return $s;
}
public function run(): void
{
$w = 'WORLD';
$text = <<<TEXT
HELLO {$this->say($w)}
TEXT;
var_dump($text);
}
}
new C()->run();
// Output:
// string(11) "HELLO WORLD"
----
Server IP: 206.189.2.9
Probable Submitter: 109.235.223.239
----
Manual Page -- https://php.net/manual/en/language.types.string.php
Edit -- https://main.php.net/note/edit/130596
Del: integrated -- https://main.php.net/note/delete/130596/integrated
Del: useless -- https://main.php.net/note/delete/130596/useless
Del: bad code -- https://main.php.net/note/delete/130596/bad+code
Del: spam -- https://main.php.net/note/delete/130596/spam
Del: non-english -- https://main.php.net/note/delete/130596/non-english
Del: in docs -- https://main.php.net/note/delete/130596/in+docs
Del: other reasons-- https://main.php.net/note/delete/130596
Reject -- https://main.php.net/note/reject/130596
Search -- https://main.php.net/manage/user-notes.php