Basic items, user functions, functions, return, global, static

Source: Internet
Author: User
In terms of structure, there are strict differences between uppercase letters of C, C ++, JAVA, and Perl and lowercase letters. For example, $ I and $ I are two different variables. Basic items

In terms of structure, there are strict differences between uppercase letters of C, C ++, JAVA, and Perl and lowercase letters.

For example, $ I and $ I are two different variables.

Therefore, properly describe the upper and lower case letters of the function.

The delimiters and Perl are somewhat different in structure.

<And <are required.

Print <END_OF_HTML does not end 「;」.

Do not end with ";" at the end of END_OF_HTML 「;」.

print <<< END_OF_HTML

abcde

fghijkl

END_OF_HTML;

It is possible to place the number of delimiters into the variable.

$msg = <<< END_OF_HTML

abcde

fghijkl

END_OF_HTML;

Parameters are the same as those in C.
The address can also be transferred.

User functions
Function UserFunction ($ para1, $ para2,...) {global $ a; static $ B; $ c = 1; encoding... return returncode ;}

** Return values can be sent in return.

** The address sent to the parameter is UserFunction (& $ para1 ).

** Function UserFunction (& $ para1, & $ para2 ,...) The specified address can also be sent to functions.

Sample code verification
 Variable \ $ a = $

\ N "; print"

Variable \ $ B = $ B

\ N "; print"

Variable \ $ c = $ c

\ N "; print"

Variable \ $ d = $ d

\ N "; print"

Variable \ $ e = $ e

\ N "; /* ===================================================== ======================================== test function ========================================================== ====================== */function test ($ p) {global $ a; static $ B; $ c = 1; $ a + = 10; $ B + = 20; $ c + = 30; $ p + = 40; return (50) ;}?>

[Execution result]

Variable $ a = 110

Variable $ B = 200

Variable $ c = 300

Variable $ d = 400

Variable $ e = 50

** $ A, use the function test (), global $ a;, and declare it as 110.

** $ B, $ c, $ d, and functions become other things in test () without being affected.

The local variables and scope of common concepts of global functions are the same as those of VB.

You can refer to "VB basics (part 5) function construction (sub, function )』.

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.