NOVINKA: Najžiadanejšie rekvalifikačné kurzy teraz s 50% zľavou + kurz AI ZADARMO. Nečakaj, táto ponuka dlho nevydrží! Zisti viac:

PHP - function_exists

Trieda

Koreň \ Bez triedy

Metóda - function_exists

(PHP 4, PHP 5, PHP 7)

Checks whether a specified function exists, including user-defined functions.

Note: Some functions can exist based on a result returned by this function, but could not be unusable due to compile-time or run-time configuration of the PHP interpreter. These can be e.g. image manipulation functions.

Procedurálne

Parametre

NázovDátový typPredvolená hodnotaPopis
$function_namestring

The name of the function as string.

Mávratovej hodnoty

Vracia: bool

Returns true if the specified function exists and is a function.

Note: This function returns false for constructs which aren't functions, for example include_once or echo.

Príklady

<?php

echo function_exists('implode') ? 'Function exists.' : 'Function does not exist.'; // Output: 'Function exists.'
echo function_exists('echo')    ? 'Function exists.' : 'Function does not exist.'; // Output: 'Function does not exist.'

echo function_exists('nonexistentFunction') ? 'Function exists.' : 'Function does not exist.'; // Output: 'Function does not exist.'

Súvisiace manuály

      Aktivity