Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

php variable circular reference

 
Php Variable Circular References

Circular-references has been a long outstanding issue with PHP. They are
caused by the fact that PHP uses a reference counted memory allocation
mechanism for its internal variables. This causes problems for longer
running scripts (such as an Application Server
or
the eZ Components
test-suite) as the memory is not freed until the end of the request. But
not everybody is aware on what exactly the problem is, so here is a
small introduction to circular references in PHP.

In PHP a refcount value is kept for every variable container (zval).
Those containers are pointed to from a function's symbol table that
contains the names of all the variables in the function's scope. Every
variable, array element or object property that points to a zval will
increase its refcount by one. The refcount of a zval container is
decreased by one whenever call unset() on a variable name that points to
it, or when a variable goes away because the function in which it was
used ends. For a more thorough explanation about references, please see
the article on this
that I
wrote for php|architect
some time
ago.

The problems with circular references all start by creating an array or
an object:

<?php
$tree = array( 'one' );
?>
This creates the following structure in memory:


Now if we proceed to add a new element to the array, that points back to
the array with:

<?php
$tree[] = $tree;
?>
We create a circular reference like this:


As you can see there are two variable names pointing to the array
itself. Once through the $tree variable, and once through the 2nd
element of the array. Because there are two variable names pointing to
the container, its refcount is 2.

Now, the next step that actually creates the problem if we unset() the
$tree variable. As I mentioned before an unset() on a variable name will
decrease the refcount of the variable container the variable poi


Ïà¹ØÎĵµ£º

PHPµÄCRUDÀà

ÒòΪÏîÄ¿ÐèÒª£¬ËùÒÔ×Ô¼ºÐ´ÁËÒ»¸öCRUDÀà
ËäÈ»»¹±È½Ï¼òµ¥£¬²»¹ý¸Ð¾õºÜʵÓá£
×¢£ºcls_databaseÊÇÒ»¸öÊý¾Ý¿â²Ù×÷Àà
¼û£ºhttp://code.google.com/p/cyy0523xc/source/browse/trunk/php/cls_crud.php
<?php
/**
* ×Ô¶¯»¯Êý¾Ý±í²Ù×÷Àà
* @author С²Ì <cyy0523xc@gmail.com>
* @version 1.0
*/
class cls_ ......

Run PHP on the Google App Engine

Google launched their Google App Engine (GAE) a year ago. The free hosting in App Engine is allocated 500 MB of persistent storage and enough CPU and bandwidth for about 5 million page views a month. Also, if you really want more you can see pricing plans.
GAE will support Java going forw ......

PHPÔ´´úÂë¼òµ¥·ÖÎö

PHPÔ´´úÂë¼òµ¥·ÖÎö
1. Ŀ¼½á¹¹
   1. build ºÍ±àÒëÓйصÄĿ¼¡£
   2. ext À©Õ¹¿â´úÂ룬ÀýÈç Mysql¡¢zlib¡¢iconv µÈÎÒÃÇÊìϤµÄÀ©Õ¹¿â¡£
   3. main Ö÷Ŀ¼¡£
   4. sapi ºÍ¸÷ÖÖ·þÎñÆ÷µÄ½Ó¿Úµ÷Óã¬ÀýÈçapache¡¢IISµÈ£¬Ò²°üº¬Ò»°ãµÄfastcgi¡¢cgiµÈ¡£
   5. wi ......

php + mysq + linux УÈËÊ´¦ÍøÕ¾

ÒÔÇ°Ò»Ö±¸ãC++½øÐÐC/S¿ª·¢£¬Ôø¾­µÄÏë·¨ÊÇÈç¹ûÓлú»á£¬Ñ§Ñ§¸ãÍøÕ¾ºÍǶÈëʽ¿ª·¢
ûÏëµ½ÕÒµ½¹¤×÷µÄµÚ2Ìì¾ÍÓÐÁË×öÍøÕ¾µÄ»ú»á£¬Ò²×¬µ½ÁË×Ô¼º´óѧÆÚ¼ä×î¸ßµÄÒ»·Ý¹¤×Ê£¬10Ìì1000¿é
ÔÚʲôµÄ¶¼²»»áµÄÇé¿öÏ£¬¾¡È»´ðÓ¦ÈËÊ´¦µÄÀÏʦһ¸öÐÇÆÚдºÃÍøÕ¾µÄºǫ́
ÎÒ³ÐÈÏÕÒµ½¹¤×÷ºó×Ô¼ºÊÇÓеã¿ñÁË£¬ºÜ¶àÊÂûעÒâµ½£¬ºÜ¶àʺó»Ú²»ÁË¡£¡£¡£ ......

PHPʵÏÖͼƬÉÏ´«

#################################
##########BY:Moskey.Tong#########
###########2009-11-15############
#########*תÔØÇë×¢Ã÷*############
#################################
×ܽáÒ»ÏÂÕâ¸öÐÇÆÚÌìPHPÉÏ´«Í¼Æ¬¡£
ÉÏ´«Í¼Æ¬Ô­Àí£ºÊ×ÏÈÅжÏÎļþÀàÐÍÊÇ·ñΪͼƬ¸ñʽ£¬ÈôÊÇÔòÉÏ´«Îļþ£¬È»ºóÖØÃüÃûÎļþ£¨Ò»°ã¶¼ÊDZÜÃâÉ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ