Most Referenced Functions
  » google_pagerank()
  » preg_replace()
  » imagecreatefrompng()
  » site_pageranks()
  » imagepng()
  » imagedestroy()
  » imagestring()
  » imagecolorallocate()
  » htmlentities()
  » fopen()
  » preg_match()
  » header()
  » getimagesize()
  » htmlspecialchars()
  » ob_start()
  » session_start()
  » strstr()
  » ob_flush()
  » preg_match_all()
  » strpos()
  » flush()
  » setcookie()
  » str_replace()
  » array2vars()
  » nl2br()
  » preg_split()
  » ereg()
  » urlencode()
  » ereg_replace()
  » readgzfile()

Become a sponsor for $15/month. Link is sitewide - PR5 homepage, 20+ PR4 pages, 90+ PR3 pages. Email dave[AT]icemelon[D0T]c0m.

PHP Functions

Function: defined

(PHP 3, PHP 4, PHP 5)

defined --  Checks whether a given named constant exists

Description

bool defined ( string name )

Returns TRUE if the named constant given by name has been defined, FALSE otherwise.

Example 1. Checking Constants

<?php
/* Note the use of quotes, this is important.  This example is checking 
 * if the string 'CONSTANT' is the name of a constant named CONSTANT */
if (defined('CONSTANT')) {
    echo CONSTANT;
}
?>

Note: If you want to see if a variable exists, use isset() as defined() only applies to constants . If you want to see if a function exists, use function_exists() .

Related Function(s)

  • isset()
  • function_exists()
  • define()
  • constant()
  • get_defined_constants()
  • Icemelon -- PHP, CSS, Javascript Tutorials, & More!
      © 2005-2010 Icemelon.com   Email: dave[AT]icemelon[D0T]c0m