Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4128640
README.md
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
README.md
View Options
#
sebastian
/
comparator
[](https://github.com/sebastianbergmann/comparator/actions)
[](https://shepherd.dev/github/sebastianbergmann/comparator)
This
component
provides
the
functionality
to
compare
PHP
values
for
equality
.
##
Installation
You
can
add
this
library
as
a
local
,
per
-
project
dependency
to
your
project
using
[
Composer
](
https
:
//getcomposer.org/):
```
composer
require
sebastian
/
comparator
```
If
you
only
need
this
library
during
development
,
for
instance
to
run
your
project
'
s
test
suite
,
then
you
should
add
it
as
a
development
-
time
dependency
:
```
composer
require
--
dev
sebastian
/
comparator
```
##
Usage
```
php
<?
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"
;
}
```
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 19, 09:21 (2 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
f0/4b/23e8fa0df3904bd4e61343cb5325
Default Alt Text
README.md (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment