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
How the values are ordered in an array?
What is a namespace in php?
How to get a total number of rows available in the table?
How to create an empty array in php?
How to enable parsing?
What is apache and php?
How do you pass a variable by value?
Describe session in php.
Is rent a variable cost?
Why do we use in php?
What is trim codeigniter?
What is the main difference between php 4 and php 5?
Which PHP function would you use to send an email?
What is rtrim php?
Which php function will attach one file to another?