PHP Array Key encoding?

前端 未结 5 1214
野的像风
野的像风 2020-12-19 13:49

I use a encoded string as a key in array, and also uses the same string as a value in the array, like below code indicates:

$string = \'something in some enc         


        
5条回答
  •  [愿得一人]
    2020-12-19 14:03

    I don't know if you can encode correctly string to use them as keys in an array, but even if it is possible to use such variables names :

    • $élement = 'foo';
    • $garçon = 'bar';

    (note the ç and the é)

    It is not recommended. You should not rely on this.

    You would probably map with current english name or use indexes.

    For utf8 encoding, take a look at the php manual.

提交回复
热议问题