Php Exit Example - Php

How to use php exit funtion?

Snippet Code


  
Rate this page :
  [ 0 votes]

Exit is a simple function in php which prints a output message and terminate the current running script. The sample php code using exit function is given below.

<?php<br>error_reporting(0);<br>$filename = 'tests.txt';<br>$open = fopen($filename, "r");<br>$size = filesize($filename);<br>$count = fread($open, $size);<br>echo($count);<br>$file = fopen($filename, 'r')<br> or exit("unable to open file ($filename)");<br>?>

Tags


Ask Questions

Ask Question