public static function removeValue(
    $subject, $property, $value, $options=array()) {
    self::setdefaults($options, array(
      'propertyIsArray' => false));

    // filter out value
    $filter = function($e) use ($value) {
      return !self::compareValues($e, $value);
    };
    $values = self::getValues($subject, $property);
    $values = array_values(array_filter($values, $filter));

    if(count($values) === 0) {
      self::removeProperty($subject, $property);
    } else if(count($values) === 1 && !$options['propertyIsArray']) {
      $subject->{$property} = $values[0];
    } else {
      $subject->{$property} = $values;
    }
  }
public static function removeValue(
    $subject, $property, $value, $options=array()) {
    self::setdefaults($options, array(
      'propertyIsArray' => false));

    // filter out value
    $filter = function($e) use ($value) {
      return !self::compareValues($e, $value);
    };
    $values = self::getValues($subject, $property);
    $values = array_values(array_filter($values, $filter));

    if(count($values) === 0) {
      self::removeProperty($subject, $property);
    } else if(count($values) === 1 && !$options['propertyIsArray']) {
      $subject->{$property} = $values[0];
    } else {
      $subject->{$property} = $values;
    }
  }
public static function removeValue ( $ subject , $ property , $ value , $ options = array ( ) ) { self :: setdefaults ( $ options , array ( 'propertyIsArray' => false ) ) ; // filter out value $ filter = function ( $ e ) use ( $ value ) { return ! self :: compareValues ( $ e , $ value ) ; } ; $ values = self :: getValues ( $ subject , $ property ) ; $ values = array_values ( array_filter ( $ values , $ filter ) ) ; if ( count ( $ values ) === 0 ) { self :: removeProperty ( $ subject , $ property ) ; } else if ( count ( $ values ) === 1 && ! $ options [ 'propertyIsArray' ] ) { $ subject -> { $ property } = $ values [ 0 ] ; } else { $ subject -> { $ property } = $ values ; } }
Removes a value from a subject.

@param stdClass $subject the subject.
@param string $property the property that relates the value to the subject.
@param mixed $value the value to remove.
@param assoc [$options] the options to use:
[propertyIsArray] true if the property is always an array,
false if not (default: false).
Removes a value from a subject .