Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

remove a specific element from array inside a loop php

$Array = array('Dog' , 'Cat' , 'Bird');
$count = count($Array);

for ($x = 0; $x < $count; $x++) {

	if ($Array[$x] == 'Cat'){
		//If 
		array_splice($Array, $x, 1);
    	$x = $x - 1;
    	$count = $count - 1;
        
   	}
    
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #specific #element #array #loop #php
ADD COMMENT
Topic
Name
7+6 =