KennisbankExamencentrum
NL · NLNederlands (Nederland)
Taal kiezen13

CKTIS / PHP

is_callable()

Controleert of een waarde vanuit het huidige bereik aanroepbaar is.

Versie: PHP 8.4; repository runtime, production runtime not attested

Syntax

is_callable(mixed $value, bool $syntax_only = false, ?string &$callable_name = null): bool

Controleert of een waarde vanuit het huidige bereik aanroepbaar is. Bij syntax_only kan de geldige naam van een niet-bestaande functie slagen. Het derde argument ontvangt de naam. Gebruik vóór aanroepen de volledige controle.

Signatuur

is_callable(mixed $value, bool $syntax_only = false, ?string &$callable_name = null): bool

Uitvoer van het voorbeeld

[true,"strlen",true,false]

Voorbeelden

<?php
$ok = is_callable("strlen", false, $name);
echo json_encode([$ok, $name, is_callable("missing_fn_204", true), is_callable("missing_fn_204")]);

Resultaat

[true,"strlen",true,false]

Bronnen