php - What does & in &$data do? -


The question of a quick start in PHP.

What & amp; IN & amp; What is the difference with $ data $ data?

  Create a function menu (and $ data) {$ this- & gt; Db- & gt; Where ('parent', 0) ... ...  

its One example is what will happen, if you run the following program:

  $ data = 3; Print ($ data); PrepareMenu ($ data); Print ($ data); Function Ready menu (and $ data) {$ data = 7; Print ($ data); }  

You will get the output:

  3 7 7  

While you pass the value, rather the reference From:

  $ data = 3; Print ($ data); PrepareMenu ($ data); Print ($ data); Function Ready Menu ($ data) {$ data = 7; Print ($ data); }  

You will get the output:

  3 7 3  

As a second example, in the value $ data For use in designing copied , as opposed to the first example where you are always working with original dollar data

Note: Not written in PHP Year, so it's not really expected to compile, it's just an example) =


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -