3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function getConstantName($category, $constantNumber) { foreach (get_defined_constants() as $key => $value) { if (strlen($key) > strlen($category)) { if (substr($key, 0, strlen($category)) === $category) { if ($value === $constantNumber) { return $key; } return "No constant found."; } } } } getConstantName('IMAGE', 1);
Output for 4.3.0 - 7.2.0