I have 10 elements of Array, how can i remove 5 array
element, with single function.
Answer Posted / sunil kumar
<?php
$a=array(1,2,3,4,75,46,17,8,9,10);
$size=count($a);
$position=4; //whose number is 75
for($i=$position;$i<$size-1;$i++)
$a[$i]=$a[$i+1]; //5th element is deleted
for($i=0;$i<$size-1;$i++) //displaying the array
echo $a[$i]."<br>";
?>
for any doubt contact sunilnagpal30@yahoo.in
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain what are the different errors in php?
What do you mean range() in php?
Which is faster for or foreach?
How can we submit a form without using submit buttons?
What is the difference between pop3 IMAP and MAPI?
What is file upload?
Tell me what is the meaning of a final class and a final method?
How to create a mysql connection?
Can constructor be private in php?
What are sql functions?
Why do we use query?
What is difference between base_url and site_url?
Write a program to get lcm of two numbers using php?
Explain what does the function get_magic_quotes_gpc() means?
What is use of count() function in php?