PHP Web Tutorial

Source: Internet
Author: User

Getting Started with PHP: HTTP://WWW.IMOOC.COM/LEARN/54

3-2 How to define variables

The "Var_dump" function displays the data type of our variables (described later in the section).

<? php $var _name=" Apple "; $n=var_dump ($var _name); var_dump ($n);? >

Output:

String (6) "Apple"
Int (10)

3-3 naming conventions for variable names

1. Variable names must begin with a letter or underscore "_", such as "$_name", "$name", "$name 2", etc., but "$9name" is not correct.

2, the variable name can only be composed of letters, numbers, and "_", but also contain Chinese characters. such as "$_qq", "$QQ 308", "$my _apple", "such as" $name I Wait ", but" $name * "is wrong.

3. Variable names are not allowed to contain spaces. When the variable name consists of multiple words, it is recommended to use "_" to separate (for example $my _apple), commonly known as the underscore method, or start with a capital letter such as $myApple, commonly known as camel-named (also known as the Hump name).

In particular, it is important to note that in PHP variable names are case-sensitive , such as "$my _book" and "$my _book" represent two different variables.

PHP Web Tutorial

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.