Skip to content

Commit

Permalink
Merge pull request #1 from Tamnac/Tamnac-patch-1
Browse files Browse the repository at this point in the history
[php/en] Add more information for strings
  • Loading branch information
Tamnac authored Jul 23, 2023
2 parents e4f276b + cc6c14b commit 5021698
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions php.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ $escaped = "This contains a \t tab character.";
$unescaped = 'This just contains a slash and a t: \t';

// Enclose a variable in curly braces if needed
$apples = "I have {$number} apples to eat.";
$oranges = "I have ${number} oranges to eat.";
$money = "I have $${number} in the bank.";
$number = 23;
$apples = "I have {$number} apples to eat."; // => I have 23 apples to eat.
$oranges = "I have ${number} oranges to eat."; // => I have 23 oranges to eat.
$money = "I have $${number} in the bank."; // => I have $23 in the bank.

// Since PHP 5.3, nowdocs can be used for uninterpolated multi-liners
$nowdoc = <<<'END'
Expand All @@ -109,7 +110,7 @@ $sgl_quotes
END;

// String concatenation is done with .
echo 'This string ' . 'is concatenated';
echo 'This string ' . 'is concatenated'; // Returns 'This string is concatenated'

// Strings can be passed in as parameters to echo
echo 'Multiple', 'Parameters', 'Valid'; // Returns 'MultipleParametersValid'
Expand Down

0 comments on commit 5021698

Please sign in to comment.