I was taking a look at the PHP Manual on the variables . There I found a snippet of code that left me with the "back foot".
$täyte = 'mansikka'; // válido; 'ä' é um caracter ASCII (extendido) 228
I always see in php beginner tutorials that it is not a good idea to declare variables with accents and the like. However, now in the PHP Manual I saw this variable $täyte
.
I decided to run a test ...
$usuário = 'Wallace';
$cidadão = 'Brasileiro';
$preferências = ['PHP', 'jQuery'];
print_r(compact('usuário', 'cidadão', 'preferências'));
var_dump($usuário);
... and I got this result:
Array
(
[usuário] => Wallace
[cidadão] => Brasileiro
[preferências] => Array
(
[0] => PHP
[1] => jQuery
)
)
string(7) "Wallace"
See the IDEONE that everything went well.
Another point I'd like to put is that when I was learning a bit of java
, I saw a snippet of code like this:
JButton botão = new JButton();
And that also worked correctly.
Questions
-
Is it a common practice among programming languages to not use accented characters in the variable declaration?