public function interval($pitch, $heightless = false) {
    	if ($pitch === null) {
    		return 0;
    	}
        // gotta be a strict equals, so it handles octave = 0
    	if ($pitch->octave === null || $this->octave === null) {
    		$heightless = true;
    	}
    	if ($heightless) {
    		$pitch->octave = 0;
    		$copy = clone $this;
    		$copy->octave = 0;
    		$interval = $pitch->toNoteNumber() - $this->toNoteNumber();
    		while ($interval < 0) {
    			$interval += 12;
    		}
    		if ($interval > 7) {
    			$interval = 12 - $interval;
    		}
    		return $interval;
    	} else {
	        return $pitch->toNoteNumber() - $this->toNoteNumber();
    	}
    }
public function interval($pitch, $heightless = false) {
    	if ($pitch === null) {
    		return 0;
    	}
        // gotta be a strict equals, so it handles octave = 0
    	if ($pitch->octave === null || $this->octave === null) {
    		$heightless = true;
    	}
    	if ($heightless) {
    		$pitch->octave = 0;
    		$copy = clone $this;
    		$copy->octave = 0;
    		$interval = $pitch->toNoteNumber() - $this->toNoteNumber();
    		while ($interval < 0) {
    			$interval += 12;
    		}
    		if ($interval > 7) {
    			$interval = 12 - $interval;
    		}
    		return $interval;
    	} else {
	        return $pitch->toNoteNumber() - $this->toNoteNumber();
    	}
    }
public function interval ( $ pitch , $ heightless = false ) { if ( $ pitch === null ) { return 0 ; } // gotta be a strict equals, so it handles octave = 0 if ( $ pitch -> octave === null || $ this -> octave === null ) { $ heightless = true ; } if ( $ heightless ) { $ pitch -> octave = 0 ; $ copy = clone $ this ; $ copy -> octave = 0 ; $ interval = $ pitch -> toNoteNumber ( ) - $ this -> toNoteNumber ( ) ; while ( $ interval < 0 ) { $ interval += 12 ; } if ( $ interval > 7 ) { $ interval = 12 - $ interval ; } return $ interval ; } else { return $ pitch -> toNoteNumber ( ) - $ this -> toNoteNumber ( ) ; } }
gives the interval between this pitch and the given one.
0 means the pitches are enharmonic.
&lt; 0 means the interval is downward,
&gt; 0 means the interval is upward

@param  Pitch $pitch the pitch being checked
@param  bool $heightless if this is true, then we check the interval as heightless pitches, returning the smaller one.
if either of the pitches being checked is heightless, then this is forced to true
@return integer the interval in semitones
gives the interval between this pitch and the given one . 0 means the pitches are enharmonic . &lt ; 0 means the interval is downward &gt ; 0 means the interval is upward