From d8cde6fd3520101fd636950bbf1e629cb157ead7 Mon Sep 17 00:00:00 2001 From: Regan Tewksbury <35713033+reganmarie@users.noreply.github.com> Date: Tue, 12 Sep 2023 13:07:57 -0700 Subject: [PATCH 1/5] Create number-format.md - Created number-format.md on filepath docs/content/php/concepts/string-functions/terms/number-format/number-format.md - Added Title, Description, Subjects, Tags, and Catalog Content - Added description, syntax, example, and codebyte example - Ran through 3 online plagiarism checkers to ensure 100% unique wording and description, passed with 100% - Followed content and style guidelines -Checked for spelling and grammar errors --- .../terms/number-format/number-format.md | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 content/php/concepts/string-functions/terms/number-format/number-format.md diff --git a/content/php/concepts/string-functions/terms/number-format/number-format.md b/content/php/concepts/string-functions/terms/number-format/number-format.md new file mode 100644 index 00000000000..426e9f3459d --- /dev/null +++ b/content/php/concepts/string-functions/terms/number-format/number-format.md @@ -0,0 +1,54 @@ +--- +Title: 'number_format()' +Description: 'Formats a number with grouped thousands' +Subjects: + - 'Computer Science' + - 'Web Design' + - 'Web Development' +Tags: + - 'Strings' + - 'Functions' +CatalogContent: + - 'learn-php' + - 'paths/computer-science' +--- + +The **`number_format()`** function takes a given number and formats it with grouped thousands. If a decimal is given, the number will be rounded up. + +## Syntax + +```pseudo +number_format($number, $decimals, $decimal_point, $separator); +``` +- `number`: The number to format. +- `decimals`: Optional argument that sets the number of digits after the decimal point. If not given, the number returned will be a whole number. +- `decimal_point`: Optional argument that specifies the decimal separator and should be given in string format. +- `separator`: Optional argument that specifies the thousands separator and should be given in string format. + +## Example + +The first example uses the `number_format()` function to format a whole number using `","` as a decimal separator and `"x"` as a thousands separator. + +```php + +``` + +This is the output for the above example: + +```shell +1x000x000,00 +``` + +## Codebyte Example + +The following codebyte example can be run and calls the `number_format()` method two times. The second call uses the optional `decimals`, `decimal_point`, and `separator` arguments. + + +```codebyte/php + +``` From 415d25b2084941d0e9c330f09cce5f48757fab53 Mon Sep 17 00:00:00 2001 From: Regan Tewksbury <35713033+reganmarie@users.noreply.github.com> Date: Tue, 12 Sep 2023 13:13:50 -0700 Subject: [PATCH 2/5] Update number-format.md --- .../string-functions/terms/number-format/number-format.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/php/concepts/string-functions/terms/number-format/number-format.md b/content/php/concepts/string-functions/terms/number-format/number-format.md index 426e9f3459d..dae3a0533aa 100644 --- a/content/php/concepts/string-functions/terms/number-format/number-format.md +++ b/content/php/concepts/string-functions/terms/number-format/number-format.md @@ -27,7 +27,7 @@ number_format($number, $decimals, $decimal_point, $separator); ## Example -The first example uses the `number_format()` function to format a whole number using `","` as a decimal separator and `"x"` as a thousands separator. +This example uses the `number_format()` function to format a whole number using `","` as a decimal separator and `"x"` as a thousands separator. ```php Date: Tue, 12 Sep 2023 13:21:40 -0700 Subject: [PATCH 3/5] Run yarn format on number-format.md Ran yarn format:all to pass verify lint and formatting --- .../string-functions/terms/number-format/number-format.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/php/concepts/string-functions/terms/number-format/number-format.md b/content/php/concepts/string-functions/terms/number-format/number-format.md index 426e9f3459d..9bc73afe857 100644 --- a/content/php/concepts/string-functions/terms/number-format/number-format.md +++ b/content/php/concepts/string-functions/terms/number-format/number-format.md @@ -20,6 +20,7 @@ The **`number_format()`** function takes a given number and formats it with grou ```pseudo number_format($number, $decimals, $decimal_point, $separator); ``` + - `number`: The number to format. - `decimals`: Optional argument that sets the number of digits after the decimal point. If not given, the number returned will be a whole number. - `decimal_point`: Optional argument that specifies the decimal separator and should be given in string format. @@ -45,7 +46,6 @@ This is the output for the above example: The following codebyte example can be run and calls the `number_format()` method two times. The second call uses the optional `decimals`, `decimal_point`, and `separator` arguments. - ```codebyte/php Date: Tue, 12 Sep 2023 15:03:29 -0700 Subject: [PATCH 4/5] Update number-format.md with revisions in pull request - Changed Description - Removed a subject so there are only two - Changed argument to parameter - Changed "given in string format" to "given as a string" - Changed output wording to "this will result in the following output" - Added new line to Codebyte example - Changed 'arguments' to 'parameters' in Codebyte explanation --- .../terms/number-format/number-format.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/content/php/concepts/string-functions/terms/number-format/number-format.md b/content/php/concepts/string-functions/terms/number-format/number-format.md index e5b1f5abb5f..f1fed3fb45e 100644 --- a/content/php/concepts/string-functions/terms/number-format/number-format.md +++ b/content/php/concepts/string-functions/terms/number-format/number-format.md @@ -1,10 +1,9 @@ --- Title: 'number_format()' -Description: 'Formats a number with grouped thousands' +Description: 'Returns a given value formatted with grouped thousands.' Subjects: - 'Computer Science' - 'Web Design' - - 'Web Development' Tags: - 'Strings' - 'Functions' @@ -22,9 +21,9 @@ number_format($number, $decimals, $decimal_point, $separator); ``` - `number`: The number to format. -- `decimals`: Optional argument that sets the number of digits after the decimal point. If not given, the number returned will be a whole number. -- `decimal_point`: Optional argument that specifies the decimal separator and should be given in string format. -- `separator`: Optional argument that specifies the thousands separator and should be given in string format. +- `decimals`: Optional parameter that sets the number of digits after the decimal point. If not given, the number returned will be a whole number. +- `decimal_point`: Optional parameter that specifies the decimal separator and should be given as a string. +- `separator`: Optional parameter that specifies the thousands separator and should be given as a string. ## Example @@ -36,7 +35,7 @@ This example uses the `number_format()` function to format a whole number using ?> ``` -This is the output for the above example: +This will result in the following output: ```shell 1x000x000,00 @@ -44,11 +43,11 @@ This is the output for the above example: ## Codebyte Example -The following codebyte example can be run and calls the `number_format()` method two times. The second call uses the optional `decimals`, `decimal_point`, and `separator` arguments. +The following codebyte example can be run and calls the `number_format()` method two times. The second call uses the optional `decimals`, `decimal_point`, and `separator` parameters. ```codebyte/php ``` From c6625dbaedfe21c83a701560be8fd1a5664561c2 Mon Sep 17 00:00:00 2001 From: Caupolican Diaz Date: Wed, 13 Sep 2023 09:53:23 -0700 Subject: [PATCH 5/5] parameter formatting --- .../terms/number-format/number-format.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/content/php/concepts/string-functions/terms/number-format/number-format.md b/content/php/concepts/string-functions/terms/number-format/number-format.md index f1fed3fb45e..ba1ceaa21d4 100644 --- a/content/php/concepts/string-functions/terms/number-format/number-format.md +++ b/content/php/concepts/string-functions/terms/number-format/number-format.md @@ -20,10 +20,10 @@ The **`number_format()`** function takes a given number and formats it with grou number_format($number, $decimals, $decimal_point, $separator); ``` -- `number`: The number to format. -- `decimals`: Optional parameter that sets the number of digits after the decimal point. If not given, the number returned will be a whole number. -- `decimal_point`: Optional parameter that specifies the decimal separator and should be given as a string. -- `separator`: Optional parameter that specifies the thousands separator and should be given as a string. +- `$number`: The number to format. +- `$decimals`: Optional parameter that sets the number of digits after the decimal point. If not given, the number returned will be a whole number. +- `$decimal_point`: Optional parameter that specifies the decimal separator and should be given as a string. +- `$separator`: Optional parameter that specifies the thousands separator and should be given as a string. ## Example @@ -43,7 +43,7 @@ This will result in the following output: ## Codebyte Example -The following codebyte example can be run and calls the `number_format()` method two times. The second call uses the optional `decimals`, `decimal_point`, and `separator` parameters. +The following codebyte example can be run and calls the `number_format()` method two times. The second call uses the optional `$decimals`, `$decimal_point`, and `$separator` parameters. ```codebyte/php