note 107881 added to language.references.arent
| From: | shuimuqingshu at gmail dot com | Date: | Tue, 13 Mar 2012 02:57:18 +0000 |
| Subject: | note 107881 added to language.references.arent | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186618@lists.php.net to get a copy of this message | ||
i think the code below can tell the difference between PHP reference and C pointer:
In PHP:
<?php
$a = 0;
$b = &a;
echo $a; //0
unset($b); // unset $b
echo $a; //0 it's OK
?>
In C:
#include <stdio.h>
int main(int argc, char const *argv[]) {
int a = 0;
int* b = &a;
printf("%i\n", a); //0
free(b); // free b
printf("%i\n", a); //get error: *** error for object 0x7fff6350da08: pointer being
freed was not allocated
}
----
Server IP: 69.147.83.197
Probable Submitter: 180.111.42.170
----
Manual Page -- http://www.php.net/manual/en/language.references.arent.php
Edit -- https://master.php.net/note/edit/107881
Del: integrated -- https://master.php.net/note/delete/107881/integrated
Del: useless -- https://master.php.net/note/delete/107881/useless
Del: bad code -- https://master.php.net/note/delete/107881/bad+code
Del: spam -- https://master.php.net/note/delete/107881/spam
Del: non-english -- https://master.php.net/note/delete/107881/non-english
Del: in docs -- https://master.php.net/note/delete/107881/in+docs
Del: other reasons-- https://master.php.net/note/delete/107881
Reject -- https://master.php.net/note/reject/107881
Search -- https://master.php.net/manage/user-notes.php