国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Comment détruire une variable statique en php ?
淡淡煙草味
淡淡煙草味 2017-05-16 12:58:25
0
1
756
function testStatic(){
    unset($arr);
    static $arr=array();
    array_push($arr, 1,2,3);
    var_dump($arr);
}
testStatic();        
//array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) }
testStatic();
//array(6) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(1) [4]=> int(2) [5]=> int(3) }

Lors de la deuxième exécution de testStatic(), $arr ne peut pas être détruit correctement en utilisant unset ; comment puis-je détruire complètement la variable statique??

淡淡煙草味
淡淡煙草味

répondre à tous(1)
過去多啦不再A夢

Documentation

如果在函數(shù)中 unset() 一個靜態(tài)變量,那么在函數(shù)內(nèi)部此靜態(tài)變量將被銷毀。但是,當(dāng)再次調(diào)用此函數(shù)時,此靜態(tài)變量將被復(fù)原為上次被銷毀之前的值。

De:http://php.net/manual/zh/func...

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal