PHP Basics 2

Source: Internet
Author: User
One, function assignment problem
    function Add ($num 1, $num 2=5) {        echo $num 1+ $num 2;    }    Add (5,19);
Second, global variables
  • Add a variable to the global variable array
    • When invoked: $GLOBALS [' global variable name '];
    • In a function called global variables requested in the global, you want to use global declaration in the function, for example:
      • Global $a;
Third, static variables
  • A local variable is revoked when the function exits, but the static variable does not, and the value is preserved when the function is called again.
    • static $a;
Iv. include, include_once, require, require_once
  • Include: can make multiple calls, error, and then continue to execute.
    • Include_once: can only be called once and is no longer executed if it has been previously called.
  • Require: The difference from include in the event of an error will stop at the point of error.
    • Require_once: The difference with include_once is that the error will stop.

PHP Basics 2

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.