What is the main difference between the following statements?

Jenumeao

New Member
Recently i was studying the "Passing by Reference", I come to know following waysWhat is the main difference between the following methods.1.\[code\]function foo(&$var){ $var++;}$a=5;foo($a);\[/code\]2.\[code\]function foo($var){ $var++;}$a=5;foo(&$a);\[/code\]3.\[code\]function foo(&$var){ $var++;}function &bar(){ $a = 5; return $a;}foo(bar());\[/code\]even though all of them produce same results, and which is the best way to work with.Thanks.
 
Back
Top