PHPackages                             malantonio/dewey - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. malantonio/dewey

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

malantonio/dewey
================

Parse and compare Dewey Decimal System call numbers.

v1.1.0(10y ago)523MITPHPPHP &gt;=5.3.13

Since Mar 31Pushed 10y ago1 watchersCompare

[ Source](https://github.com/malantonio/dewey)[ Packagist](https://packagist.org/packages/malantonio/dewey)[ Docs](https://github.com/malantonio/dewey)[ RSS](/packages/malantonio-dewey/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Dewey Decimal Classification tools
==================================

[](#dewey-decimal-classification-tools)

[![Build Status](https://camo.githubusercontent.com/eeef1bd41a6f7c8de44429d4f786ff3953c6b08a884311797e700277fdcb6371/68747470733a2f2f7472617669732d63692e6f72672f6d616c616e746f6e696f2f64657765792e7376673f6272616e63683d7472617669732d737570706f7274)](https://travis-ci.org/malantonio/dewey)

a collection of tools to work w/ Dewey Decimal call numbers

some terminology explanation
----------------------------

[](#some-terminology-explanation)

To the best of my (admittedly lacking) knowledge, there is no set terminology to differentiate the whole numbers from the decimals in a Dewey Decimal System call number. Internally, the following terms are used to refer to the different parts:

For the call number `DVD 741.4372 A123b c.2 v.3 2004`:

```
term     | value

```

\-------------|------ `prestamp` | `DVD``major` | `741``minor` | `4372``cutter` | `A123b``additional` | `c.2 v.3 2004``call number`| `741.4372`

What's also a bit confusing is the differentiation between a call number and a CallNumber object. Unless specifically referencing the CallNumber object's $callNumber field, the camel-cased CallNumber refers to the object and lower-cased `call number` refers to the major/minor combination.

Please add an issue if you've got some suggestions re: clearing the code up!

usage
-----

[](#usage)

The `Dewey` class has a few static methods for general use:

### `Dewey::calculateRange($rangeString)`

[](#deweycalculaterangerangestring)

Calculate the range of DDS call numbers using an `*` to specify where the range takes place. Returns a tuple array of `[$min, $max]`

#### example

[](#example)

```
$drawing = Dewey::calculateRange("74*");
// returns `array("740", "750")`
```

range stringreturned array`7**``["700", "800"]``74*``["740", "750"]``741.*``["741", "742"]``741.4*``["741.4", "741.5"]`### `Dewey::compare($input, $comparison, $operator[, $includePrestamp = false])`

[](#deweycompareinput-comparison-operator-includeprestamp--false)

Compare `$input` to `$comparison` using `$operator`. Accepts: ``, `=`, `==`, `===`. `$includePrestamp` will involve the prestamp in the comparison. Returns a boolean.

#### example

[](#example-1)

```
var_dump(Dewey::compare("741.4372 A123x", "750", "
