Skip to content

Instantly share code, notes, and snippets.

@raveren
Forked from ircmaxell/equality.php
Last active August 29, 2015 14:13
Show Gist options
  • Save raveren/8cdaf1c923af90f0fb34 to your computer and use it in GitHub Desktop.
Save raveren/8cdaf1c923af90f0fb34 to your computer and use it in GitHub Desktop.
<?php
const ✓ = true;
const ✕ = false;
function ≠($left, $right) {
return $left != $right;
}
function ≅($left, $right) {
return ($left > $right - 0.0001) && ($left < $right + 0.0001);
}
function ≡($left, $right) {
return $left === $right;
}
function ≢($left, $right) {
return $left !== $right;
}
<?php
function ∅() {
return array();
}
function ∃($value, array $set) {
return ✕ !== array_search($value, $set, true);
}
function ∄($value, array $set) {
return ✕ === array_search($value, $set, true);
}
function ∩(array $set1, array $set2) {
return array_intersect($set1, $set2);
}
function ∪(array $set1, array $set2) {
return array_merge($set1, $set2);
}
function ⊂(array $subset, array $superset) {
return $subset == ∩($subset, $superset);
}
function ⊃(array $superset, array $subset) {
return ⊂($subset, $superset);
}
function ⊄(array $subset, array $superset) {
return !⊂($subset, $superset);
}
function ⊅(array $superset, array $subset) {
return !⊂($subset, $superset);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment