mirror of
https://github.com/php/doc-en.git
synced 2026-03-25 00:02:17 +01:00
Fix #81635: No example of complex interpolation syntax with filenames
This commit is contained in:
@@ -827,8 +827,8 @@ Changing the character at index -3 to o gives strong.
|
||||
<simpara>
|
||||
Any scalar variable, array element or object property with a
|
||||
<type>string</type> representation can be included via this syntax.
|
||||
Simply write the expression the same way as it would appear outside the
|
||||
<type>string</type>, and then wrap it in <literal>{</literal> and
|
||||
The expression is written the same way as it would appear outside the
|
||||
<type>string</type>, and then wrapped in <literal>{</literal> and
|
||||
<literal>}</literal>. Since <literal>{</literal> can not be escaped, this
|
||||
syntax will only be recognised when the <literal>$</literal> immediately
|
||||
follows the <literal>{</literal>. Use <literal>{\$</literal> to get a
|
||||
@@ -884,6 +884,11 @@ echo "This is the value of the var named by the return value of \$object->getNam
|
||||
|
||||
// Won't work, outputs: This is the return value of getName(): {getName()}
|
||||
echo "This is the return value of getName(): {getName()}";
|
||||
|
||||
// Won't work, outputs: C:\folder\{fantastic}.txt
|
||||
echo "C:\folder\{$great}.txt"
|
||||
// Works, outputs: C:\folder\fantastic.txt
|
||||
echo "C:\\folder\\{$great}.txt"
|
||||
?>
|
||||
]]>
|
||||
<!-- maybe it's better to leave this out??
|
||||
|
||||
Reference in New Issue
Block a user