Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Explain what are the different errors in php?

962


What do you mean range() in php?

1057


Which is faster for or foreach?

906


How can we submit a form without using submit buttons?

930


What is the difference between pop3 IMAP and MAPI?

1017


What is file upload?

1033


Tell me what is the meaning of a final class and a final method?

1068


How to create a mysql connection?

926


Can constructor be private in php?

992


What are sql functions?

910


Why do we use query?

884


What is difference between base_url and site_url?

972


Write a program to get lcm of two numbers using php?

925


Explain what does the function get_magic_quotes_gpc() means?

891


What is use of count() function in php?

994