summaryrefslogtreecommitdiffhomepage
path: root/php.html.markdown
diff options
context:
space:
mode:
Diffstat (limited to 'php.html.markdown')
-rw-r--r--php.html.markdown11
1 files changed, 6 insertions, 5 deletions
diff --git a/php.html.markdown b/php.html.markdown
index 821bde8f..1ef52f68 100644
--- a/php.html.markdown
+++ b/php.html.markdown
@@ -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'
@@ -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'
@@ -443,7 +444,7 @@ $bar('C'); // Prints "A - B - C"
// You can call named functions using strings
$function_name = 'add';
echo $function_name(1, 2); // => 3
-// Useful for programatically determining which function to run.
+// Useful for programmatically determining which function to run.
// Or, use call_user_func(callable $callback [, $parameter [, ... ]]);