Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report

sebastian/comparator 6.0.0

Provides the functionality to compare PHP values for equality
Package summary
Share
0
issues
0
licenses
Package created
22 Jan 2014
Version published
2 Feb 2024
Maintainers
1
Total deps
0
Direct deps
0
License
BSD-3-Clause
Generating a report...
Hold on while we generate a fresh audit report for this package.

Frequently Asked Questions

What does sebastian/comparator do?

Sebastian/comparator is a handy PHP library that provides the functionality to compare PHP values for equality. This could be beneficial in numerous scenarios where you need to ascertain if the given PHP values are equal or not.

How do you use sebastian/comparator?

To use sebastian/comparator, you need to follow these simple steps:

First, you need to install the library using Composer. It can be added either as a local, per-project dependency:

composer require sebastian/comparator

Or, if you only need this library during development (for instance, to run your project's test suite), you can add it as a development-time dependency:

composer require --dev sebastian/comparator

Once installed, you can use it in your PHP scripts like so:

<?php
use SebastianBergmann\Comparator\Factory;
use SebastianBergmann\Comparator\ComparisonFailure;

$date1 = new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York'));
$date2 = new DateTime('2013-03-29 03:13:35', new DateTimeZone('America/Chicago'));

$factory = new Factory;
$comparator = $factory->getComparatorFor($date1, $date2);

try {
    $comparator->assertEquals($date1, $date2);
    print "Dates match";
} catch (ComparisonFailure $failure) {
    print "Dates don't match";
}

In the above snippet, we're using the library to compare two date objects.

Where are the sebastian/comparator docs?

The Sebastian/comparator's documentation isn't hosted on a separate website. You can instead refer to its GitHub page for detailed instructions on installing and using the library. The "readme" file in the repository provides a comprehensive guide to get started with sebastian/comparator.