Get value of dynamically chosen class constant in PHP December 8, 2022 by Tarik Use the constant() function: $id = constant("ThingIDs::$thing");