3v4l.org

run code in 300+ PHP versions simultaneously
<?php $isInternalConstantDeprecatedFx = function (string $const) { $isDeprecated = false; $origHandler = set_error_handler(function (int $no, string $message) use (&$isDeprecated): bool { if ($no === E_DEPRECATED /* || $no === E_USER_DEPRECATED */) { $isDeprecated = true; } return true; }); try { constant($const); } finally { if ($origHandler !== null) { set_error_handler($origHandler); } } return $isDeprecated; }; $deprecatedConstants = []; foreach (get_defined_constants(true) as $groupKey => $groupConstants) { if ($groupKey === 'user') { continue; } foreach ($groupConstants as $k => $v) { if ($isInternalConstantDeprecatedFx($k)) { $deprecatedConstants[] = $k; } } } print_r($deprecatedConstants);

preferences:
18.19 ms | 407 KiB | 5 Q