Page 1 of 1
[SOLVED] Where is the & symbol for in some functions?
Posted: Sat Jul 03, 2004 9:48 am
by WaldoMonster
Sometimes I see functions like this:
Code: Select all
<?php
Function (&$some_value)
{
// Do something
}
?>
Where is the & symbol for?
Posted: Sat Jul 03, 2004 9:50 am
by feyd
reference.. basically, $some_value will be a pointer, if you're familiar to that term, to the data passed. The function is able to directly modify the content of the data passed to it, so it could return lots of extended data..
Posted: Sat Jul 03, 2004 10:08 am
by WaldoMonster
Is this the purpose of the reference?
Where can I find some more information about pointers and reference?
Code: Select all
<?php
function AddMonster(&$name)
{
$name .= 'Monster';
}
$name = 'Waldo';
AddMonster($name);
echo $name; //returns WaldoMonster
?>
Posted: Sat Jul 03, 2004 10:10 am
by feyd
that's exactly the use.

[php_man]references[/php_man]
Posted: Sat Jul 03, 2004 10:20 am
by WaldoMonster
Thanks for the help.
Now it is comming back to me.
It works the same way as Turbo Pascal, that is a long time ago

Posted: Sat Jul 03, 2004 3:33 pm
by John Cartwright
omg pascal........ the pain.
i remember in grade 10 i made slimmer
