mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Created array_remove_value function
This commit is contained in:
		
							
								
								
									
										25
									
								
								functions/arrays.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								functions/arrays.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
<?php
 | 
			
		||||
/**
 | 
			
		||||
 * Arrays functions
 | 
			
		||||
 *
 | 
			
		||||
 * @author Pierre HUBERT
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Delete a specified value from an array
 | 
			
		||||
 *
 | 
			
		||||
 * @param array $array The array to process
 | 
			
		||||
 * @param Mixed $value The value to remove from the array
 | 
			
		||||
 * @return Boolean True for a success
 | 
			
		||||
 */
 | 
			
		||||
function array_remove_value(array &$array, $value){
 | 
			
		||||
 | 
			
		||||
	//Process value
 | 
			
		||||
	foreach($array as $key=>$item){
 | 
			
		||||
		if($item === $value)
 | 
			
		||||
			unset($array[$key]);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	//Success
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user