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
What does a special set of tags do in php?
Tell me what are the __construct() and __destruct() methods in a php class?
What is the difference between super () and this ()?
What is the use of inner join in mysql?
What is alias in php?
List some string function name in php?
How we get browser details of clients machine?
Can the value of a constant change during the script's execution?
What is super keyword in c++?
What type of operation is needed when passing values through a form or an url?
What does $_cookie means?
What is overloading and overriding in oop?
What is the maximum size of a table in mysql?
What is variable give example?
What are php filters?