php銷毀變量的方法:我們可以使用unset()函數(shù)來銷毀給定的變量。具體使用方法如:【unset($foo)】,表示要銷毀單個變量;【unset($foo1, $foo2, $foo3)】,表示要銷毀多個變量。
可以使用unset()函數(shù)來銷毀給定的變量。
(推薦教程:php圖文教程)
注意:該函數(shù)沒有返回值。
語法:
void unset ( mixed $var [, mixed $... ] )
參數(shù):
-
$var: 要銷毀的變量
(學習視頻推薦:php視頻教程)
舉例:
<?php // 銷毀單個變量 unset ($foo); // 銷毀單個數(shù)組元素 unset ($bar['quux']); // 銷毀一個以上的變量 unset($foo1, $foo2, $foo3); ?>