CKTIS / PHP
function_exists()
Test a function name case-insensitively against internal and user-defined functions currently available.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
function_exists(string $function): boolTest a function name case-insensitively against internal and user-defined functions currently available. Language constructs such as echo have no function entry. Inside a namespace, pass the qualified name to look up its own function.
Signature
function_exists(string $function): bool
Example output
[true,true,false]
Examples
<?php
namespace Shop;
function total() { return 5; }
echo json_encode([function_exists(__NAMESPACE__ . "\\TOTAL"),function_exists("strlen"),function_exists("echo")]);
Result
[true,true,false]