close

 

<?php
$xyz='w3resource.com';
echo 'Before using unset() the value of $xys is : '. $xyz.'<br>';
unset($xyz);
echo 'After using unset() the value of $xys is : '. $xyz;
?>

輸出:
Before using unset() the value of $xys is : w3resource.com
After using unset() the value of $xys is :


<?php
// 銷毀單個變量
unset ($foo);

// 銷毀單個數組元素
unset ($bar['quux']);

// 銷毀一個以上的變量
unset($foo1, $foo2, $foo3);
?>


<?php
$name = 'Felipe';

var_dump((unset) $name);
var_dump($name);
?>
以上例程會輸出:

NULL
string(6) "Felipe

arrow
arrow
    全站熱搜

    stockwfj3 發表在 痞客邦 留言(0) 人氣()