Skip to main content
Commonmark migration
Source Link

#PHP, 60 bytes

PHP, 60 bytes

boring: regexp once more the shortest solution

<?=preg_match("/([^1]|^)(1st|2nd|3rd|\dth)$|1\dth$/",$argn);

empty output for falsy, 1 for truthy.

Run as pipe with -nF or try it online. (TiO wrapped as function for convenience)

#PHP, 60 bytes

boring: regexp once more the shortest solution

<?=preg_match("/([^1]|^)(1st|2nd|3rd|\dth)$|1\dth$/",$argn);

empty output for falsy, 1 for truthy.

Run as pipe with -nF or try it online. (TiO wrapped as function for convenience)

PHP, 60 bytes

boring: regexp once more the shortest solution

<?=preg_match("/([^1]|^)(1st|2nd|3rd|\dth)$|1\dth$/",$argn);

empty output for falsy, 1 for truthy.

Run as pipe with -nF or try it online. (TiO wrapped as function for convenience)

Source Link
Titus
  • 14.8k
  • 1
  • 24
  • 41

#PHP, 60 bytes

boring: regexp once more the shortest solution

<?=preg_match("/([^1]|^)(1st|2nd|3rd|\dth)$|1\dth$/",$argn);

empty output for falsy, 1 for truthy.

Run as pipe with -nF or try it online. (TiO wrapped as function for convenience)