To delete data and variables, you can use the unset function in php. Of course, you can also use the null function to process them. However, you can destroy the variable so that the php variable disappears in the memory.
To delete data and variables, you can use the unset function in the php tutorial. Of course, you can also use the null function. However, destroy the variable so that the php variable disappears in the memory.
*/
$ Array = array ('A' => 1, 'bb '=> 2 );
Function delete (& $ array, $ key)
{
If (! Is_array ($ key )){
$ Key = array ($ key );
}
Foreach ($ key as $ k ){
Unset ($ array [$ k]);
}
$ Array = array_values ($ array );
}
Print_r (array_values ($ array ));
Print_r (delete ($ array, 'A '));
/*
Unset ();
This function allows you to cancel the key name in an array. Note that the array will not rebuild the index.
$ A = array (1 => 'one', 2 => 'two', 3 => 'three ');
Unset ($ a [2]);
/* Generates an array, defined
$ A = array (1 => 'one', 3 => 'three ');
Instead
$ A = array (1 => 'one', 2 => 'three ');
Clear the entire array
Unset ($ arr );
4: Clear the specified Element
Unset ($ arr [index]);
Unset () destroys the specified variable. Note that in php 3, unset () returns true (actually an integer value of 1 ),
In php 4, unset () is no longer a real function: it is now a statement