Last active
April 19, 2019 13:52
-
-
Save ircmaxell/4715602 to your computer and use it in GitHub Desktop.
Unicode Set Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function ∅() { | |
return array(); | |
} | |
function ∃($value, array $set) { | |
return false !== array_search($value, $set, true); | |
} | |
function ∄($value, array $set) { | |
return false === 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
Fun !