W3Schools.com

PHP defined() Function


PHP Misc Reference Complete PHP Misc Reference

Definition and Usage

The defined() function checks whether a constant exists.

Returns TRUE if the constant exists, or FALSE otherwise.

Syntax

defined(name)

Parameter Description
name Required. Specifies the name of the constant to check


Example

<?php
define("GREETING","Hello you! How are you today?");
echo defined("GREETING");
?>

The output of the code above will be:

1


PHP Misc Reference Complete PHP Misc Reference
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$7.95/mo SEO Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Free Website Templates Free CSS Templates
Make Your Own Website
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE