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 are the file upload settings in configuration file?
What is the difference between public, protected and private?
What is string and its function?
How many types of php are there?
What is the difference between == and === in php?
Do while loops?
How to remove duplicate values from array using php?
How many data types are used by php?
What is csrf cookie?
Does https prevent csrf?
What is polymorphism in php?
What is the difference between rest and soap?
Is it difficult to learn php?
Is null check in php?
How to download and install php for windows?