[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-doc-cvs
Subject:    [DOC-CVS] [doc-en] master: Update string.xml to remove old string interpolation (#2712)
From:       Eddie Kohler via GitHub <noreply () php ! net>
Date:       2023-08-26 16:53:35
Message-ID: EoALx9Gv7G1O2M72wDPyWj9MhCLYFTDLg1XDphR27k () main ! php ! net
[Download RAW message or body]

Author: Eddie Kohler (kohler)
Committer: GitHub (web-flow)
Pusher: adoy
Date: 2023-08-26T12:40:09-04:00

Commit: https://github.com/php/doc-en/commit/48e35e9d0d985710d8f04ac998eb357b40bff9af
Raw diff: https://github.com/php/doc-en/commit/48e35e9d0d985710d8f04ac998eb357b40bff9af.diff

Update string.xml to remove old string interpolation (#2712)

An example used the deprecated `${varname}` syntax; fix it.

Changed paths:
  M  language/types/string.xml


Diff:

diff --git a/language/types/string.xml b/language/types/string.xml
index 86588818217..8aabc4806e2 100644
--- a/language/types/string.xml
+++ b/language/types/string.xml
@@ -721,10 +721,10 @@ EOT;
 $juice = "apple";
 
 echo "He drank some $juice juice.".PHP_EOL;
-// Invalid. "s" is a valid character for a variable name, but the variable is $juice.
+// Unintended. "s" is a valid character for a variable name, so this refers to $juices, not $juice.
 echo "He drank some juice made of $juices.";
-// Valid. Explicitly specify the end of the variable name by enclosing it in braces:
-echo "He drank some juice made of ${juice}s.";
+// Explicitly specify the end of the variable name by enclosing the reference in braces.
+echo "He drank some juice made of {$juice}s.";
 ?>
 ]]>
      </programlisting>

-- 
PHP Documentation Commits Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic