PHP/File Directory/ LINE

Материал из Web эксперт
Перейти к: навигация, поиск

Echoing the line and file predefined constants

   <source lang="html4strict">

<?php echo "Executing line " . __LINE__ . " of PHP script " . __FILE__ . "."; ?>

 </source>
   
  


Using __FILE__ and __LINE__

   <source lang="html4strict">

<?php

   function report_error($file, $line, $message) {
       echo "An error occured in $file on line $line: $message.";
   }
   report_error(__FILE__,__LINE__, "Something went wrong!");

?>

 </source>