Constants are similar to variables, but they may be set only once. Some of them are created automatically by PHP; others you will create with the define function discussed. You do not use the dollar-sign operator to get the value of a constant, and aconstant may never be used on the left side of an assignment operator. Constants ignore scope and are therefore visible inside functions without the use of the global statement. Although it is not necessary, it is customary to name constants exclusively with capital letters.
Using a Constant
PHP creates several constants upon startup. PHP_VERSION contains the version of PHP running the script. TRUE is set to 1. FALSE is set to 0. PHP_OS describes the operating system. E_ERROR, E_WARNING, E_NOTICE, E_PARSE, E_ALL are for use with the error_reporting function. You can also use __FILE__ and __LINE__ to get the name of the executing script and the line number, respectively. The value of pi is stored in the constant M_PI. Some extensions create constants, too.
PHP Related Interview Questions
|PHP Interview Questions||MySQL Interview Questions|
|PHP+MySQL Interview Questions||Drupal Interview Questions|
|MYSQL DBA Interview Questions||PHP5 Interview Questions|
|WordPress Interview Questions||Joomla Interview Questions|
|CakePHP Interview Questions||CodeIgniter Interview Questions|
|PHP7 Interview Questions|
An Introduction To Php
Variables, Operators, And Expressions
Classes And Objects
I/o And Disk Access
Time, Date, And Configuration Functions
Parsing And String Evaluation
Sorting Searching And Random Numbers
Integration With Html
Efficiency And Debugging
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.