[doc-en] master: variables: Describe how non-ASCII variable names behave instead of asserting they are unsupported (#5831)

From: Date: Fri, 04 Sep 2026 08:22:55 +0000
Subject: [doc-en] master: variables: Describe how non-ASCII variable names behave instead of asserting they are unsupported (#5831)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23714@lists.php.net to get a copy of this message
Author: Ótzï fón GlüϷgor (Otzie2023) Committer: GitHub (web-flow) Pusher: jordikroon Date: 2026-09-04T10:22:52+02:00 Commit: https://github.com/php/doc-en/commit/0e72b54621406de1c5642334258462725ca99a29 Raw diff: https://github.com/php/doc-en/commit/0e72b54621406de1c5642334258462725ca99a29.diff variables: Describe how non-ASCII variable names behave instead of asserting they are unsupported (#5831) * Describe how non-ASCII variable names behave The note claimed PHP "doesn't support Unicode variable names" and then explained that they work anyway. Replace it with a description of the observable behaviour. Co-authored-by: Louis-Arnaud <la.catoire@gmail.com> Changed paths: M language/variables.xml Diff: diff --git a/language/variables.xml b/language/variables.xml index 710a69bf4224..95d21540ef85 100644 --- a/language/variables.xml +++ b/language/variables.xml @@ -23,10 +23,22 @@ <note> <simpara> - PHP doesn't support Unicode variable names, however, some character - encodings (such as UTF-8) encode characters in such a way that all bytes - of a multi-byte character fall within the allowed range, thus making it a - valid variable name. + Variable names are compared as bytes, not as characters. PHP does not + interpret or validate the encoding of the bytes from 128 through 255, and + two names refer to the same variable only when their bytes are identical. + </simpara> + <simpara> + One consequence is that names written in UTF-8 work, because every byte of + a UTF-8 multi-byte sequence falls inside the accepted range. The same holds + for any encoding whose non-ASCII bytes all fall in that range, and for byte + sequences that are not valid text in any encoding. Encodings that use bytes + below 128 within a multi-byte sequence, such as Shift-JIS or UTF-16, do not. + </simpara> + <simpara> + Another is that two names which display identically may be distinct. + <literal>ä</literal> encoded as U+00E4 and as <literal>a</literal> + followed by the combining diaeresis U+0308 are different variables, as are + a name with and without a trailing U+00A0 NO-BREAK SPACE. </simpara> </note>

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