note 112323 added to language.references.pass
| From: | Anonymous | Date: | Sat, 01 Jun 2013 09:53:19 +0000 |
| Subject: | note 112323 added to language.references.pass | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-195022@lists.php.net to get a copy of this message | ||
Function arguments involving references is following the trait of the C language.
For those who knows the C language, the following example should shed some light on the behavior of
PHP.
struct _A {
int value;
};
void change_reference (struct _A* a)
{
a->value = 4;
a = malloc(sizeof(struct _A)); // a becomes a local variable
a->value = 5;
}
main ()
{
struct _A* A = malloc(sizeof(struct _A));
A->value = 2;
change_reference (A);
printf("%d", A->value); // echo 4 (not 5)
}
----
Server IP: 69.147.83.199
Probable Submitter: 193.49.30.34
----
Manual Page -- http://php.net/manual/en/language.references.pass.php
Edit -- https://master.php.net/note/edit/112323
Del: integrated -- https://master.php.net/note/delete/112323/integrated
Del: useless -- https://master.php.net/note/delete/112323/useless
Del: bad code -- https://master.php.net/note/delete/112323/bad+code
Del: spam -- https://master.php.net/note/delete/112323/spam
Del: non-english -- https://master.php.net/note/delete/112323/non-english
Del: in docs -- https://master.php.net/note/delete/112323/in+docs
Del: other reasons-- https://master.php.net/note/delete/112323
Reject -- https://master.php.net/note/reject/112323
Search -- https://master.php.net/manage/user-notes.php