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 is the use of mysql_real_escape_string() function?
Why is php so popular?
What is the method to execute a php script from the command line?
What is the correct syntax of mail() function in php?
Are php variables global?
What is a lambda function in php?
I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what’s the problem?
armstrong number by using php while number is given by the keyboard.?
Explain scalar type declarations in php7?
Is php coding easy?
How can we determine whether a variable is set?
Does php support function overloading?
Require_once(), require(), include(). What is difference between them?
What is return value in php?
How can you retrieve data from the mysql database using php?