ments.
To count the number of elements in an array using the count() function..
$size = count($array);
-Kevin
- Original Message -
From: "Martin Clifford" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, June 12, 2002 1:10
I have an online example of the progam at
http://www.recordconsulting.com/temp/shop.php. Each of the delete links use the
corresponding index values for the array, and use the unset() function to remove them.
While I'm here... how do I find the amount of information in an array? JavaScript
p
$nums = array ('one', 'two', 'three');
$nums = remove_array_element($nums, 1);
function remove_array_element($array, $index)
{
unset($array[$i]); // Unset selected index
return array_values($array); // Return reindexed array
}
P.S. The empty() function returns true or false depending up
unset() works for this, how are you using it
exactly? Please post a short test script
that misbehaves for you.
$arr = array('foo','bar');
unset($arr[0]);
print_r($arr); // only $arr[1] = 'bar' exists now
See also: http://www.php.net/unset
http://www.php.net/array_splice
Reg
This is all i've ever been able to do:
function ck_removeValueFromArray($array, $value) {
$key = array_search($value, $array);
if ($key) {
$array[$key] = "";
rsort($array); // rsort() puts blank values at the end
reset($array);
5 matches
Mail list logo