From 02998950d60e03d9e61ac573422b724e4578df06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93tz=C3=AF=20f=C3=B3n=20Gl=C3=BC=CF=B7gor?= <141450226+Otzie2023@users.noreply.github.com> Date: Thu, 3 Sep 2026 20:47:38 +0200 Subject: [PATCH 1/2] 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. --- language/variables.xml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/language/variables.xml b/language/variables.xml index 710a69bf4224..21f40343ba2f 100644 --- a/language/variables.xml +++ b/language/variables.xml @@ -23,10 +23,21 @@ - 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. + + + 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. So do names + written in other encodings, and so do byte sequences that are not valid + text in any encoding. + + + Another is that two names which display identically may be distinct. + รค encoded as U+00E4 and as a + followed by the combining diaeresis U+0308 are different variables, as are + a name with and without a trailing U+00A0 NO-BREAK SPACE. From 5930719979cf5be786cda4f45f28802e764aaf34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93tz=C3=AF=20f=C3=B3n=20Gl=C3=BC=CF=B7gor?= <141450226+Otzie2023@users.noreply.github.com> Date: Fri, 4 Sep 2026 09:45:14 +0200 Subject: [PATCH 2/2] Update language/variables.xml Co-authored-by: Louis-Arnaud --- language/variables.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/language/variables.xml b/language/variables.xml index 21f40343ba2f..95d21540ef85 100644 --- a/language/variables.xml +++ b/language/variables.xml @@ -29,9 +29,10 @@ 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. So do names - written in other encodings, and so do byte sequences that are not valid - text in any encoding. + 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. Another is that two names which display identically may be distinct.