Since PHP 8.2, placing the dollar sign outside the curly brace is deprecated when
the expression inside the braces resolves to a variable or an expression.
* Introduce a new php compatible library which can be used
early in execution, without Moodle dependencies
* Use it where we previously had hardcoded checks
This was originally suggested in MDL-39007.