Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

searching and removing element from an array php

<?php
$hackers = array ('Alan Kay', 'Peter Norvig', 'Linus Trovalds', 'Larry Page');

print_r($hackers);

// Search
$pos = array_search('Linus Trovalds', $hackers);

echo 'Linus Trovalds found at: ' . $pos;

// Remove from array
unset($hackers[$pos]);

print_r($hackers);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #searching #removing #element #array #php
ADD COMMENT
Topic
Name
2+7 =