[doc-en] master: Increment/decrement operators: correct PHP 8.3 deprecations on strings (#5934)

From: Date: Tue, 13 Oct 2026 11:16:08 +0000
Subject: [doc-en] master: Increment/decrement operators: correct PHP 8.3 deprecations on strings (#5934)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23838@lists.php.net to get a copy of this message
Author: KentarouTakeda (KentarouTakeda) Committer: GitHub (web-flow) Pusher: lacatoire Date: 2026-10-13T13:16:06+02:00 Commit: https://github.com/php/doc-en/commit/4bf52f20bcb7f0f7dee5e8e1f6e8afc7126f06ce Raw diff: https://github.com/php/doc-en/commit/4bf52f20bcb7f0f7dee5e8e1f6e8afc7126f06ce.diff Increment/decrement operators: correct PHP 8.3 deprecations on strings (#5934) * Increment/decrement operators: correct PHP 8.3 deprecations on strings * Update language/operators/increment.xml Co-authored-by: Louis-Arnaud <la.catoire@gmail.com> --------- Co-authored-by: Louis-Arnaud <la.catoire@gmail.com> Changed paths: M language/operators/increment.xml Diff: diff --git a/language/operators/increment.xml b/language/operators/increment.xml index d30da3d1c59a..1e0509e782ef 100644 --- a/language/operators/increment.xml +++ b/language/operators/increment.xml @@ -101,12 +101,13 @@ int(4) A <constant>E_WARNING</constant> is emitted as of PHP 8.3.0, because this will implicitly cast the value to <type>int</type> in the future. </para> - <para> + <simpara> The decrement operator has no effect on non- - <link linkend="language.types.numeric-strings">numeric string</link>. - A <constant>E_WARNING</constant> is emitted as of PHP 8.3.0, + <link linkend="language.types.numeric-strings">numeric string</link>, + except the empty string, which becomes <literal>-1</literal>. + A <constant>E_DEPRECATED</constant> is emitted as of PHP 8.3.0, because a <classname>TypeError</classname> will be thrown in the future. - </para> + </simpara> </warning> <note> <para> @@ -136,6 +137,11 @@ int(4) For example, <code>$a = 'Z'; $a++;</code> turns <varname>$a</varname> into <literal>'AA'</literal>. </para> + <simpara> + As of PHP 8.3.0, incrementing empty or non-alphanumeric strings + emits <constant>E_DEPRECATED</constant>. + As of PHP 8.5.0, this applies to all non-numeric strings. + </simpara> <example> <title>PERL string increment example</title>

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