• SQL Tutorial
  • PHP
  • Core Java
  • jQuery
  • Java IO
  • Struts
  • JSP
  • Servlet
  • JavaScript

  • <

    PHP Constants Tutorial

    A constant value cannot be changed.It is an identifier for a simple value. During the script.Constants a constant value becames global and can be used outside of the entire script.

    A constant is case-sensitive. By convention, constant identifiers are always uppercase.Constants can not change during the script.A constant name can not start with $.


    PHP Constants Syntax


    <?php	
    	 
    define('Const Name', 'value');
    
    ?>
    

    PHP Constants Example


    <?php
    define("hello", "World");
    echo hello;
    ?>
    

    Output:
    World
    


    PHP Magic constants


  • __LINE__The current line number of the file.

  • _FILE__The full path and filename of the file.

  • __FUNCTION__The function name.

  • _CLASS__The class name.

  • __METHOD__The class method name.

















  • © copyright 2017-2021 Completedone pvt ltd.