[doc-en] master: intval: expand example with a variety of bases (#5827)
| From: | MorganLOCode via GitHub | Date: | Thu, 03 Sep 2026 06:25:16 +0000 |
| Subject: | [doc-en] master: intval: expand example with a variety of bases (#5827) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-23705@lists.php.net to get a copy of this message | ||
Author: MorganLOCode (MorganLOCode)
Committer: GitHub (web-flow)
Pusher: jordikroon
Date: 2026-09-03T08:25:13+02:00
Commit: https://github.com/php/doc-en/commit/81a581c15721591f9fdd3e36990d8b729236689d
Raw diff: https://github.com/php/doc-en/commit/81a581c15721591f9fdd3e36990d8b729236689d.diff
intval: expand example with a variety of bases (#5827)
Make explicit the fact that $base is not limited to 8, 10, and 16.
Changed paths:
M reference/var/functions/intval.xml
Diff:
diff --git a/reference/var/functions/intval.xml b/reference/var/functions/intval.xml
index 60ecbb999211..1f7f5afaf6ab 100644
--- a/reference/var/functions/intval.xml
+++ b/reference/var/functions/intval.xml
@@ -168,11 +168,16 @@ echo intval('1e10'), PHP_EOL; // 10000000000
echo intval(0x1A), PHP_EOL; // 26
echo intval('0x1A'), PHP_EOL; // 0
echo intval('0x1A', 0), PHP_EOL; // 26
+echo intval('1A', 16), PHP_EOL; // 26
echo intval(42000000), PHP_EOL; // 42000000
echo intval(420000000000000000000), PHP_EOL; // -4275113695319687168
echo intval('420000000000000000000'), PHP_EOL; // 9223372036854775807
echo intval(42, 8), PHP_EOL; // 42
echo intval('42', 8), PHP_EOL; // 34
+echo intval(42, 7), PHP_EOL; // 42
+echo intval('42', 7), PHP_EOL; // 30
+echo intval('1000', 11), PHP_EOL; // 1331
+echo intval('1ya', 36), PHP_EOL; // 2530
echo intval(array()), PHP_EOL; // 0
echo intval(array('foo', 'bar')), PHP_EOL; // 1
echo intval(false), PHP_EOL; // 0