faqts : Computers : Programming : Languages : PHP : kms : Classes

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

8 of 14 people (57%) answered Yes
Recently 2 of 6 people (33%) answered Yes

Entry

Can PHP do "reference" but not "copy" on variables in classes?

May 15th, 2000 10:08
Robert Ames, Alan Tam, http://www.php.net/manual/functions.arguments.php


You might try:
<pre>
function increment_variable( &$counter ) {
  $counter ++;

}
$number_of_hits = 0;
while( $number_of_hits < 100 ) {
  increment_variable( $number_of_hits );
}
</pre>

The key is to use the ampersand in the function name.