18-Variable Overview Global variables Linux environment variable configuration java environment change

Source: Internet
Author: User
The basic elements in modern programming languages are: variables, flow control interfaces, functions, and so on. Can I write a program without using variables? This is obviously possible, for example:


  
   

This program is simple and outputs a string content.

Just as we can program with just binary, we can do most of the work without using variables, our program loses great flexibility, and variables let us store the values for use elsewhere in the program, or we can save new values by calculating them. A variable has three basic characteristics:

    1. Name. The identifier for the variable. Like puppies, the owner may give these puppies a favorite name. In the name of the variable, PHP inherits the grammar style of Perl, where the variable begins with the dollar sign, followed by the variable name. A valid variable name begins with a letter or underscore, followed by any number of letters, numbers, or underscores. PHP also supports compound variables, which are variables like $ $a, which are interpreted two times. This gives PHP a very flexible dynamic feature.
    2. Type. The types of variables, like the breed of puppies, may vary depending on the puppy lineage, some are smart, some will shop and so on. In many static languages, variables are specified at the time of definition and are not allowed to change during the course of a program, so if you have a puppy that can only be given a random breed, will it pull the wind? This is the case with PHP, which is a weakly typed language that can be arbitrarily assigned to any type of value.
    3. The value content. This is the specific content represented by the mark. It's kind of like a real puppy. You can name any puppy: small seven, also in programming languages, you can give a variable the value it can represent the range. At the same time, however, a variable can have only one value.

The letters that make up variable names in PHP can be a-z,a-z, or ASCII characters from 127 to 255 (0X7F-0XFF). Variable names are case-sensitive.

In addition to the variables themselves, in PHP we are often exposed to variables related concepts such as: constants, global variables, static variables, and type conversions. In this chapter we will introduce these variables-related implementations. These include the variable low-level storage structure of PHP itself, the implementation of weakly typed systems, and the conversion of these types to each other.

Look at the PHP code first:


  
   

The run code will output 11 20.

But why is there such an output? How is the variable implemented inside PHP? How is the scope of the variable implemented? This chapter will discuss the topic around variables, and let's start with the most basic variable implementations.

Not all of the variables in the programming language can be changed in value. Think about the variables that we've learned in mathematics. Their values are also immutable. For example: X + y = 10; The values of the variables x and y are not changed. In a specific scenario, where only a specific value is represented in an equation, the benefit of the value of the variable cannot be changed: this will produce as little side effects as possible, in the Erlang language, which is a functional programming language and is well worth learning.

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above describes the 18-variable overview, including variables, 18 aspects of the content, I hope to be interested in PHP tutorial friends helpful.

  • Related Article

    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.