[doc-en] master: Fix outdated string to number comparison rules in clamp() (#6079)

From: Date: Sat, 14 Nov 2026 08:03:20 +0000
Subject: [doc-en] master: Fix outdated string to number comparison rules in clamp() (#6079)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23952@lists.php.net to get a copy of this message
Author: KentarouTakeda (KentarouTakeda) Committer: GitHub (web-flow) Pusher: lacatoire Date: 2026-11-14T09:03:17+01:00 Commit: https://github.com/php/doc-en/commit/2fda4df7d2f44e6edbf64976dceddcb7cb8c6fd7 Raw diff: https://github.com/php/doc-en/commit/2fda4df7d2f44e6edbf64976dceddcb7cb8c6fd7.diff Fix outdated string to number comparison rules in clamp() (#6079) Changed paths: M reference/math/functions/clamp.xml Diff: diff --git a/reference/math/functions/clamp.xml b/reference/math/functions/clamp.xml index 462d9ea76134..c1be0214b87a 100644 --- a/reference/math/functions/clamp.xml +++ b/reference/math/functions/clamp.xml @@ -21,10 +21,10 @@ <note> <simpara> Values of different types will be compared using the <link linkend="language.operators.comparison"> - standard comparison rules</link>. For instance, a non-numeric <type>string</type> will be - compared to an <type>int</type> as though it were <literal>0</literal>, but multiple non-numeric - <type>string</type> values will be compared alphanumerically. The actual value returned will be of the - original type with no conversion applied. + standard comparison rules</link>. For instance, when a non-numeric <type>string</type> is + compared to an <type>int</type>, the <type>int</type> is cast to <type>string</type> and the + values are compared as strings. Multiple non-numeric <type>string</type> values are also compared as + strings. The actual value returned will be of the original type with no conversion applied. </simpara> </note> <caution> @@ -103,7 +103,7 @@ echo clamp(103, min: 0, max: 100), PHP_EOL; // 100 echo clamp("J", min: "A", max: "F"), PHP_EOL; // "F" -clamp( +echo clamp( new \DateTimeImmutable('2025-08-01'), min: new \DateTimeImmutable('2025-08-15'), max: new \DateTimeImmutable('2025-09-15'),

« previous php.doc.cvs (#23952) next »