application/Espo/Core/Utils/Util.php
public static function unsetInArrayByValue($needle, array $haystack, $reIndex = true)
    {
        $doReindex = false;

        foreach($haystack as $key => $value) {
            if (is_array($value)) {
                $haystack[$key] = static::unsetInArrayByValue($needle, $value);
            } else if ($needle === $value) {

                unset($haystack[$key]);

                if ($reIndex) {
                    $doReindex = true;
                }
            }
        }

        if ($doReindex) {
            $haystack = array_values($haystack);
        }

        return $haystack;
    }
public static function unsetInArrayByValue($needle, array $haystack, $reIndex = true)
    {
        $doReindex = false;

        foreach($haystack as $key => $value) {
            if (is_array($value)) {
                $haystack[$key] = static::unsetInArrayByValue($needle, $value);
            } else if ($needle === $value) {

                unset($haystack[$key]);

                if ($reIndex) {
                    $doReindex = true;
                }
            }
        }

        if ($doReindex) {
            $haystack = array_values($haystack);
        }

        return $haystack;
    }
public static function unsetInArrayByValue ( $ needle , array $ haystack , $ reIndex = true ) { $ doReindex = false ; foreach ( $ haystack as $ key => $ value ) { if ( is_array ( $ value ) ) { $ haystack [ $ key ] = static :: unsetInArrayByValue ( $ needle , $ value ) ; } else if ( $ needle === $ value ) { unset ( $ haystack [ $ key ] ) ; if ( $ reIndex ) { $ doReindex = true ; } } } if ( $ doReindex ) { $ haystack = array_values ( $ haystack ) ; } return $ haystack ; }
Unset a value in array recursively

@param  string $needle
@param  array  $haystack
@param  bool   $reIndex
@return array
Unset a value in array recursively