From a550f183435fb482f6c4afc8bcf0554984ac7ec8 Mon Sep 17 00:00:00 2001 From: Michael Kramer Date: Sat, 17 Feb 2024 12:19:18 +0100 Subject: [PATCH] Improve snippet about function argument passing --- concepts/basic-syntax/about.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/concepts/basic-syntax/about.md b/concepts/basic-syntax/about.md index 9238c1e1..c9b1e391 100644 --- a/concepts/basic-syntax/about.md +++ b/concepts/basic-syntax/about.md @@ -52,16 +52,17 @@ Literal values and values stored in variables can be passed to functions. New variables are created when defining function arguments to hold values passed in. ```php -window_width(100); // Pass the literal value 100 to the function - -$newWidth = 100; -window_width($newWidth); // Pass the value stored in $newWidth to the function - +// Declare the window_width function function window_width($width) { echo $width; // Access the value passed into the function as $width // ... } + +window_width(100); // Call the function with the literal value 100 + +$newWidth = 100; +window_width($newWidth); // Call the function with the value stored in $newWidth ``` Functions may return values using the keyword `return`.