Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

PHP: How to remove specific element from an array?

$array = array('apple', 'orange', 'strawberry', 'blueberry', 'kiwi', 'strawberry'); //throw in another 'strawberry' to demonstrate that it removes multiple instances of the string
$array_without_strawberries = array_diff($array, array('strawberry'));
print_r($array_without_strawberries);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #remove #specific #element
ADD COMMENT
Topic
Name
9+9 =