PHP Reference (&) and file reference detailed (1/3)

Source: Internet
Author: User
Tags php tutorial

Quote we say two one is a variable reference is a file include reference,
The include () or require () function allows you to insert the contents of a file in a file before the server executes the PHP tutorial file. In addition to the way they handle errors, the two functions are identical in other ways. The Include () function generates a warning (but the script continues to execute), and the Require () function generates a fatal error (fatal error) (the script stops executing after the error occurs).

<?php include ("header.php");?>

<p>some text</p>


Three files, "default.php", "about.php", and "contact.php" all refer to the "menu.php" file. This is the code in "default.php":

<?php include ("menu.php");?>

<p>some text</p>

</body>

PHP reference (is to precede the variable or function, object, etc. with & symbol)

References in PHP mean that different names access the same variable content.
There is a difference between the pointers in the C language. The pointer in C language stores the address of the variable's contents in memory

References to variables

PHP references allow you to use two variables to point to the same content
[PHP]

?
$a = "ABC";
$b =& $a;
echo $a//here output: ABC
echo $b//HERE output: ABC
$b = "EFG";
echo $a//The value of $a here becomes EFG so output EFG
echo $b//Here output EFG
?>


[/php]

Home 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.