To delete data and variables in PHP using the work of the unset can be implemented, of course, you can also use the empty also processing, but destroy variables, let PHP variables in memory disappear OH.
To delete the data and variables in PHP tutorial use the work of the unset can be implemented, of course, you can also use the empty also processing, but destroy variables, let PHP variables in memory disappear OH.
*/
$array = Array (' AA ' =>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, ' AA '));
/*
Unset ();
This function allows you to cancel the key names in an array. Be aware that the array will not rebuild the index.
$a = Array (1 = ' one ', 2 = ' both ', 3 = ' three ');
Unset ($a [2]);
/* will produce an array, defined as
$a = array (1=> ' one ', 3=> ' three ');
Instead of
$a = Array (1 = ' one ', 2 = ' three ');
Empty the entire array
Unset ($arr);
4: Empty the specified element
unset ($arr [index]);
Unset () destroys the specified variable. Note 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
http://www.bkjia.com/PHPjc/445400.html www.bkjia.com true http://www.bkjia.com/PHPjc/445400.html techarticle to delete data and variables in PHP using the work of the unset can be implemented, of course, you can also use the empty also processing, but destroy variables, let PHP variables in memory disappear OH. To delete data ...