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

What does a special set of tags do in php?

932


Tell me what are the __construct() and __destruct() methods in a php class?

1004


What is the difference between super () and this ()?

1057


What is the use of inner join in mysql?

987


What is alias in php?

1037


List some string function name in php?

992


How we get browser details of clients machine?

1049


Can the value of a constant change during the script's execution?

980


What is super keyword in c++?

1006


What type of operation is needed when passing values through a form or an url?

997


What does $_cookie means?

972


What is overloading and overriding in oop?

1024


What is the maximum size of a table in mysql?

1010


What is variable give example?

1093


What are php filters?

965