php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #73843
Patch array-search-fix-fix-fix revision 2016-12-30 09:12 UTC by 376292871 at qq dot com

Patch array-search-fix-fix-fix for Arrays related Bug #73843

Patch version 2016-12-30 09:12 UTC

Return to Bug #73843 | Download this patch
Patch Revisions:

Developer: 376292871@qq.com

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', true);

// $arr = array(
//     0 => 241,
//     2 => 248,
//     3 => 249,
//     4 => 250,
//     5 => 255,
//     6 => 256,
//     7 => 257
// );



$arr = [241, 248, 249, 250, 255, 256, 257];
$except = [248, 249, 255];

foreach ($except as $value) {
    if ($key = array_search($value, $arr) !== false) {
        unset($arr[$key]);
    }
}

print_r($arr);
exit;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 22:01:30 2024 UTC