Last Updated: March 30, 2016
·
829
· nicolaskempfpro

PHP In-depth : Variables

In PHP, variables start with a $ then a name following a specific pattern similar to all other PHP labels :

  • first character : a letter, from a to z in lower case or upper case, plus all ASCII characters from codes 127 (0x7f) to 255 (0xff), or an underscore (_).
  • then : a group of letters (defined as above), underscores, or numbers.

We can use the following regular expression to represent them :

[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*

Source : http://php.net/manual/en/language.variables.basics.php

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Related Tags
#php
Did you know?

PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.

Security insights from Cside