Thursday 10 December 2015

Magic Constants

Figure 1




1 .__LINE__      

  The current line number of the file.
                     <?php
                            echo "The Line number : ". __LINE__;
                          ?>
2.__FILE__
      The full path and filename of the file.
           <?php
              echo  "Your file name :". __FILE__;
             ?>
3. PHP_VERSION
             <?php
              echo "Current PHP Version you are using  : ".PHP_VERSION;
                ?>

4.PHP_INT_MAX
   The PHP integer value limit
            <?php
                    echo "Integer Maximum Value : ".PHP_INT_MAX;
                  ?>
5.__FUNCTION__,     __CLASS__,     __METHOD__
       <?php

   class demo 
              {
            function test()

           {  echo "Function of demo class : ". __FUNCTION__ ."<br/>";  }

                    function testme()

             {  echo "Method of demo class : ". __METHOD__ ."<br/>";
                echo "Class : ". __CLASS__;
                 }
             }
           $object=new demo();
           $object->test(); 
           $object->testme();
?>