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 php parameterized functions.
What is the difference between mysql_fetch_array() and mysql_fetch_assoc()?
Why php is used with mysql?
What is in a cookie?
What does session start do in php?
Is php a dying language?
Explain soundex() and metaphone().
How is it possible to set an infinite execution time for php script?
Why should I learn php?
What is difference between Method overriding and overloading in PHP?
What is serialization in php?
What is php namespace?
What is the correct syntax of mail() function in php?
Is ruby on rails php?
Explain the difference between mysql_connect and mysql_pconnect?