protected function recursiveAssignValue(array $values, $list)
	{
		//Loop through all the children and find out if one matches our value
		foreach ( $list as $item )
		{
			//Check if this is an option or group
			if ( $item instanceof Optgroup )
			{
				$this->recursiveAssignValue($values, $item->getContents());
			}

			//We have an option so check its value
			else if ( in_array($item->getValue(), $values) )
			{
				$this->assignSelected($item);
			}
		}
	}
protected function recursiveAssignValue(array $values, $list)
	{
		//Loop through all the children and find out if one matches our value
		foreach ( $list as $item )
		{
			//Check if this is an option or group
			if ( $item instanceof Optgroup )
			{
				$this->recursiveAssignValue($values, $item->getContents());
			}

			//We have an option so check its value
			else if ( in_array($item->getValue(), $values) )
			{
				$this->assignSelected($item);
			}
		}
	}
protected function recursiveAssignValue ( array $ values , $ list ) { //Loop through all the children and find out if one matches our value foreach ( $ list as $ item ) { //Check if this is an option or group if ( $ item instanceof Optgroup ) { $ this -> recursiveAssignValue ( $ values , $ item -> getContents ( ) ) ; } //We have an option so check its value else if ( in_array ( $ item -> getValue ( ) , $ values ) ) { $ this -> assignSelected ( $ item ) ; } } }
Recursive function to be able to handle Optgroups

@param array[mixed]           $values
@param array[Option|Optgroup] $list

@since 2.0
Recursive function to be able to handle Optgroups