1
0
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:
Christoph M. Becker
2021-11-18 15:18:17 +01:00
parent 83569ce5f5
commit 59244d9ae9

View File

@@ -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??