Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions system/Helpers/number_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ function format_number(float $num, int $precision = 1, ?string $locale = null, a
/**
* Convert a number to a roman numeral.
*
* @param string $num it will convert to int
* @param int|string $num it will convert to int
*/
function number_to_roman(string $num): ?string
function number_to_roman($num): ?string
{
static $map = [
'M' => 1000,
Expand Down
4 changes: 2 additions & 2 deletions user_guide_src/source/helpers/number_helper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ The following functions are available:

.. php:function:: number_to_roman($num)

:param string $num: The number want to convert
:param int|string $num: The number want to convert
:returns: The roman number converted from given parameter
:rtype: string|null

Expand All @@ -101,4 +101,4 @@ The following functions are available:
.. literalinclude:: number_helper/009.php

This function only handles numbers in the range 1 through 3999.
It will return null for any value outside that range.
It will return ``null`` for any value outside that range.
4 changes: 2 additions & 2 deletions user_guide_src/source/helpers/number_helper/009.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

echo number_to_roman(23); // Returns XXIII
echo number_to_roman(324); // Returns CCCXXIV
echo number_to_roman(23); // Returns XXIII
echo number_to_roman(324); // Returns CCCXXIV
echo number_to_roman(2534); // Returns MMDXXXIV