Example 1 — Check If money_format() Exists
On PHP 8 the function is gone. This test shows how to detect it safely.
<?php
if (function_exists("money_format")) {
echo "money_format() exists", PHP_EOL;
} else {
echo "money_format() was removed in PHP 8.0", PHP_EOL;
} How It Works
- Ask PHP. function_exists checks without calling the function.
- Avoid a fatal error. Calling a missing function stops the script.
- Run on PHP 8. The else branch runs.
- Move on. Use one of the replacements in the next examples.

