Php reference (&) and file reference (1/3)-PHP source code

Source: Internet
Author: User
Ec (2); reference we will talk about two types of variable references: one is File include reference, through the include () or require () function, you can insert the content of a file into the file before the php tutorial file is executed on the server. Except for the way they handle errors, the two functions are the same in other aspects. The include () function generates a warning (but the script continues to execute), while the require () function generates a fatal error (fatalerr script ec (2); script

Let's talk about two types of references: variable references and file include references,
Using the include () or require () function, you can insert the content of a file into the file before the server executes the php tutorial file. Except for the way they handle errors, the two functions are the same in other aspects. The include () function generates a warning (but the script continues to execute), and The require () function generates a fatal error (the execution will be stopped when an error occurs ).

Welcome to my home page

Some text


"Default. php", "about. php", and "contact. php" all reference the "menu. php" file. This is the code in "default. php:

Welcome to my home page

Some text


Php reference (that is, adding & symbol before variables, functions, and objects)

The reference in php means that different names access the same variable content.
The pointer in the C language is different from the pointer in the C language. The pointer in the C language stores the address where the variable content is stored in the memory.

Variable reference

Php reference allows you to use two variables to point to the same content
[Php]

$ A = "abc ";
$ B = & $;
Echo $ a; // output here: abc
Echo $ B; // output here: abc
$ B = "efg ";
Echo $ a; // here, the value of $ a is changed to efg, so efg is output.
Echo $ B; // output efg here
?>


[/Php]

Homepage 1 2 3 last

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.