I have 10 elements of Array, how can i remove 5 array
element, with single function.

Answer Posted / vaneet badhan

$a=array(2,4,1,3,22,15);

for($v=0;$v<=4;$v++)
{
unset($a[$v]);
}

This code will remove elements "2,4,1,3,22" from array $a
and the output will be : "15"

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to insert an new array element in array?

526


Tell me what sized websites have you worked on in the past?

491


What are php keywords?

524


Do you know what's the difference between __sleep and __wakeup?

515


Why many companies are switching their current business language to php? Where php basically used?

489






How can we submit from without a submit button?

566


What are the two main string operators?

533


Is age an interval or ratio?

539


What is properties of class?

579


How can you tell if a number is even or odd without using any condition or loop?

509


What is difference between echo and print in php?

482


What is the function func_num_args() used for?

521


What is the difference between md5(), crc32() and sha1() crypto on php?

601


Explain me difference between mysql_connect and mysql_pconnect?

538


What is str_replace()?

529