Skip to content

Commit 211d647

Browse files
committed
allow extra args to intval
1 parent 8c0f372 commit 211d647

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

resources/lib/utils.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,13 @@ function getHyperlink($text, ...$url_components)
8484
}
8585

8686
/**
87+
* extra args (ex: base) are passed along to intval()
8788
* @throws ValueError
8889
*/
89-
function str2int(string $x): int
90+
function str2int(string $x, ...$args): int
9091
{
9192
if (is_numeric($x)) {
92-
return intval($x);
93+
return intval($x, ...$args);
9394
} else {
9495
throw new ValueError("not numeric: $x");
9596
}

0 commit comments

Comments
 (0)