Chose Language:
Author: Admin/Publisher |finished | checked

PHP Defined

Check if a constant was defined. In order to get true as return, you need to define a constant define with the name passed as the parameter. Description

defined(string $constant_name): bool


$constant_name – a string with the name of the constant, for example'BLASTCODING_CONSTANT'. Remember that constant are written in uppercase and separated with _ if is needed by convention


Return true if constant exists, else return false

Common case of use

This function is commonly use in pugins for CMS like WordPress, Joomla or others. This is cause we need to check if the plugin is being use and not execute it 2 times.

checkeo de constantes en un plugin
  // Prevent loading plugins.
  //code here
Category: en-php
Something wrong? If you found an error or mistake in the content you can contact me on Twitter | @luisg2249_luis.
Last 4 post in same category