Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the parameters passed between php functions

Shulou Source: shulou.com Published: 2022-06-03 07:36:08 10月02日 Update

This article mainly talks about "what are the parameters passed between php functions". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the parameters passed between php functions"?

Php: parameter passing between functions

1. Value transfer

The copy code is as follows:

Output result:

one

In Exam: 2

one

two。 Reference transfer

The copy code is as follows:

Output result:

one

In Exam: 2

two

3. Optional parameter

The copy code is as follows:

Function values ($price, $tax= "") {

$price + = $prive * $tax

Echo "Total Price:". $price. "

}

Values (100,0.25)

Values (100)

Output result:

Total Price: 125

Total Price: 100

4. If you pass in an object, you can change the value of that object

(in fact, the variable $obj records the handle to the object, passing in $obj as an argument, which makes it possible to manipulate the original object. )

The copy code is as follows:

Output result:

Mr. Zhan 12 male

Mr. Zhan 13 male

Mr. Zhan 14 male

At this point, I believe you have a deeper understanding of "what are the parameters passed between php functions?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Code parameters functions objects results output content actual learning practical deeper interests variables handles practicality actually simple operation methods more friends Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Shulou Information MariaDB NVidia Docker