Introduction: This is a detailed page about PhP unset. It introduces the related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 340518 'rolling = 'no'>
PHP unset is very special.
To put it simply:
Refer to the PHP manual:
<? PHP/* Imagine this is memory map __________________________ | pointer | value | variable | ------------------------------------- | 1 | null | --- | 2 | null | --- | 3 | null | --- | 4 | null | --- | 5 | null | --- | ---------------------------------------- create some variables */$ A = 10; $ B = 20; $ c = array ('one' => array (1, 2, 3);/* Look at memory _______________________________ | pointer | value | variable' S | ------------------------------- | 1 | 10 | $ A | 2 | 20 | $ B | 3 | 1 | $ C ['one'] [0] | 4 | 2 | $ C ['one'] [1] | 5 | 3 | $ C ['one'] [2] | ---------------------------------------- do */$ A = & $ C ['one '] [2]; /* Look at memory ___________________________ | pointer | value | variable's | ------------------------------------- | 1 | null | --- | // value of $ A is destroyed and pointer is free | 2 | 20 | $ B | 3 | 1 | $ C ['one'] [0] | 4 | 2 | $ C ['one'] [1] | 5 | 3 | $ C ['one'] [2], $ A | // $ A is now here -------------------------------------- do */$ B = & $ A; // or $ B = & $ C ['one'] [2]; result is same as both "$ C ['one'] [2]" and "$ A" is at same pointer. /* Look at memory _________________________________ | pointer | value | variable's | ---------------------------------------- | 1 | null | --- | 2 | null | --- | // value of $ B Is destroyed and pointer is free | 3 | 1 | $ C ['one'] [0] | 4 | 2 | $ C ['one'] [1] | 5 | 3 | $ C ['one'] [2], $ A, $ B | // $ B is now here ------------------------------------------- next do */unset ($ C ['one'] [2]); /* Look at memory _________________________________ | pointer | value | variable's | ------------------------------------------ | 1 | null | --- | 2 | null | --- | 3 | 1 | $ C ['one '] [0] | 4 | 2 | $ C ['one '] [1] | 5 | 3 | $ A, $ B | // $ C ['one'] [2] is destroyed not in memory, not in array --------------------------------------- next do */$ C ['one'] [2] = 500; // now it is in array/* Look at memory _________________________________ | pointer | value | variable's | ------------------------------------ | 1 | 500 | $ C ['one'] [2] |/ /created it lands on any (next) free pointer in memory | 2 | null | --- | 3 | 1 | $ C ['one'] [0] | 4 | 2 | $ C ['one'] [1] | 5 | 3 | $, $ B | // This pointer is in use ----------------------------------------- lets tray to return $ C ['one'] [2] at old pointer an Remove reference $ A, $ B. */$ C ['one'] [2] = & $ A; unset ($ A); unset ($ B ); /* Look at memory _________________________________ | pointer | value | variable's | ---------------------------------------- | 1 | null | --- | 2 | null | --- | 3 | 1 | $ C ['one'] [0] | 4 | 2 | $ C ['one'] [1] | 5 | 3 | $ C ['one '] [2] | // $ C ['one'] [2] is returned, $ A, $ B is destroyed -----------------------------------------?> I hope this helps.
This shows how PHP unset is implemented.
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/340518.html pageno: 7.