Differences between passing parameters in PHP and passing parameters _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
The difference between passing parameters in PHP and passing parameters. Differences between passing parameter values and passing parameters in PHP differences between passing parameter values and passing parameters in PHP this article mainly introduces the differences between passing parameter values and passing parameters in PHP, it is very simple. The difference between passing parameters and passing parameters through PHP is simple.

 Differences between passing parameters in PHP and passing parameters

This article mainly introduces the differences between passing parameter values in PHP and passing parameters, which is very simple. you can see through simple comparison of examples. if you need it, you can refer to it.

Let's talk about the code.

?

1

2

3

Function test (& val ){

Return $ val;

}

What are the advantages of using & for parameter passing?

Address transfer allows changes within the function, for example:

?

1

2

3

4

5

6

7

$ Test = "hello ";

Function myFun (& $ val ){

$ Val = "hello world ";

Return $ val;

}

Echo myFun (& $ test); // hello world

Echo $ test; // hello world

The above is all the content of this article. I hope you will like it.

Differences between passing parameters in PHP and passing parameters...

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.