Home >Backend Development >PHP Tutorial >PHP unset鍏ㄥ眬鍙橀噺杩愮椤邂璇﹁В_PHP鏁欑▼ | 宁涔嫔
PHP 涓湁涓喷鏀怕彉彉忕殑璇彞鍙仛unset锛堜粠PHP4Liaoset "簬鏄妸unset闂鍐粨沨濡备笅銆傚鏋沧偍浠旂粏闃呰杩嘝HP鐨勬坠鍐岋紝閭榅箞箰箞篬鏂囩珷浜嗭紝杩欑瘒鏂囩珷鏄启缁欑湅鎵嫔唽涓敤蹇幂殑鍚屽鐨勩€?/p>
<ol class="dp-xml"><li class="alt"> <span class="tag"><</span> ?PHP </li><li><span>function destroy_foo() { </span></li><li class="alt"><span>global $foo; </span></li><li><span>unset($foo); </span></li><li class="alt"><span>} </span></li><li><span>$</span><span class="attribute">foo</span><span> = ‘bar’; </span></li><li class="alt"><span>destroy_foo(); </span></li><li><span>echo $foo; </span></li><li class="alt"><span class="tag">?></span><span> </span> </li></ol>
杩斿洖鐨勭粨鏋滀负
涓轰粈涔堜细杩欐牱鍛紵鍘熷洜皓辨槸PHP unset鍏ㄥ眬鍙橀噺鍦ㄥ嚱鏁授予腑鍙兘閿€姣佸眜? The
<ol class="dp-xml"><li class="alt"> <span class="tag"><</span> ?PHP </li><li><span>function foo() { </span></li><li class="alt"><span>unset($GLOBALS['bar']); </span></li><li><span>} </span></li><li class="alt"><span>$</span><span class="attribute">bar</span><span> = “something”; </span></li><li><span>foo(); </span></li><li class="alt"><span>var_dump($bar); </span></li><li><span class="tag">?></span><span> </span> </li></ol>
www.bkjia.com