src/Alg/Math/RomanNumbers.php
public static function convertFromRoman( $roman )
	{
		Deprecation::getInstance()
			->setErrorVersion( '0.8.5' )
			->setExceptionVersion( '0.9' )
			->message( sprintf(
				'Please use %s (%s) instead',
				'public library "CeusMedia/Math"',
			 	'https://packagist.org/packages/ceus-media/math'
			) );
		$_r = str_replace( array_keys( $this->roman ), "", $roman );						//  prove roman number by clearing all valid numbers
		if( strlen( $_r ) )																	//  some numbers are invalid
			throw new InvalidArgumentException( "Roman '".$roman."' is invalid." );
		$integer = 0;																		//  initiating integer
		$keys	= array_keys( $this->shorts );
		$values	= array_values( $this->shorts );
		$roman = str_replace( $values, $keys, $roman );										//  resolve shortcuts
		foreach( $this->roman as $key => $value )											//  all roman number starting with biggest
		{
			$count = substr_count( $roman, $key );											//  amount of roman numbers of current value
			$integer += $count * $value;													//  increase integer by amount * current value
			$roman = str_replace( $key, "", $roman );											//  remove current roman numbers
		}
		return $integer;
	}
public static function convertFromRoman( $roman )
	{
		Deprecation::getInstance()
			->setErrorVersion( '0.8.5' )
			->setExceptionVersion( '0.9' )
			->message( sprintf(
				'Please use %s (%s) instead',
				'public library "CeusMedia/Math"',
			 	'https://packagist.org/packages/ceus-media/math'
			) );
		$_r = str_replace( array_keys( $this->roman ), "", $roman );						//  prove roman number by clearing all valid numbers
		if( strlen( $_r ) )																	//  some numbers are invalid
			throw new InvalidArgumentException( "Roman '".$roman."' is invalid." );
		$integer = 0;																		//  initiating integer
		$keys	= array_keys( $this->shorts );
		$values	= array_values( $this->shorts );
		$roman = str_replace( $values, $keys, $roman );										//  resolve shortcuts
		foreach( $this->roman as $key => $value )											//  all roman number starting with biggest
		{
			$count = substr_count( $roman, $key );											//  amount of roman numbers of current value
			$integer += $count * $value;													//  increase integer by amount * current value
			$roman = str_replace( $key, "", $roman );											//  remove current roman numbers
		}
		return $integer;
	}
public static function convertFromRoman ( $ roman ) { Deprecation :: getInstance ( ) -> setErrorVersion ( '0.8.5' ) -> setExceptionVersion ( '0.9' ) -> message ( sprintf ( 'Please use %s (%s) instead' , 'public library "CeusMedia/Math"' , 'https://packagist.org/packages/ceus-media/math' ) ) ; $ _r = str_replace ( array_keys ( $ this -> roman ) , "" , $ roman ) ; //  prove roman number by clearing all valid numbers
 if ( strlen ( $ _r ) ) //  some numbers are invalid
 throw new InvalidArgumentException ( "Roman '" . $ roman . "' is invalid." ) ; $ integer = 0 ; //  initiating integer
 $ keys = array_keys ( $ this -> shorts ) ; $ values = array_values ( $ this -> shorts ) ; $ roman = str_replace ( $ values , $ keys , $ roman ) ; //  resolve shortcuts
 foreach ( $ this -> roman as $ key => $ value ) //  all roman number starting with biggest
 { $ count = substr_count ( $ roman , $ key ) ; //  amount of roman numbers of current value
 $ integer += $ count * $ value ; //  increase integer by amount * current value
 $ roman = str_replace ( $ key , "" , $ roman ) ; //  remove current roman numbers
 } return $ integer ; }
Converts and returns a roman number as arabian number.
@access
@static
@param		string		$roman		Roman number
@return		integer
Converts and returns a roman number as arabian number .