I have 10 elements of Array, how can i remove 5 array
element, with single function.

Answers were Sorted based on User's Feedback



I have 10 elements of Array, how can i remove 5 array element, with single function...

Answer / shaik abdul raheem

<?php
$a[0]='a';
$a[1]='b';
$a[2]='c';
$a[3]='d';
$a[4]='f';
$a[5]='g';
$a[6]='h';
$a[7]='i';
unset($a[4]);
for($b=0;$b<=count($a);$b++)
{
echo $a[$b]."<br>";
}
?>

Is This Answer Correct ?    4 Yes 5 No

I have 10 elements of Array, how can i remove 5 array element, with single function...

Answer / dhir

<?php
$a[0]='a';
$a[1]='b';
$a[2]='c';
$a[3]='d';
$a[4]='f';
$a[5]='g';
$a[6]='h';
$a[7]='i';

for($b=0;$b<=4;$b++)
{
$a=shift($a[$b]);
}
?>

Is This Answer Correct ?    1 Yes 3 No

I have 10 elements of Array, how can i remove 5 array element, with single function...

Answer / guest

using "limit 1 5"

Is This Answer Correct ?    0 Yes 5 No

Post New Answer

More PHP Interview Questions

How can we submit a form without a submit button?

2 Answers   Rushmore Consultancy,


Write a program to get second highest number in an array using php?

0 Answers  


What is the difference between $argv and $argc? Give example?

0 Answers  


What are php parameters?

0 Answers  


What is the difference between indexed and associative array?

0 Answers  






Is nan in php?

0 Answers  


Does php need a closing tag?

0 Answers  


Which function is used in php to count the total number of rows returned by any query?

0 Answers  


Write a php code which could be used to generate random numbers between 1 - 100 and display them on the screen.

7 Answers  


What is a helper function?

0 Answers  


In how many ways we can retrieve the date in the result set of mysql using PHP?

5 Answers   Yahoo,


Describe the differences between the object models in PHP 4 and PHP 5.

1 Answers  


Categories