In the following example:
<?php
// this code is written to test error reporting function in runtime
error_reporting(0);
echo $var = 'hex' // I have made this mistake here by my will but error reporting message still pops up.
$name = 'rex';
?>
I wanted to turn off the error reporting in php at runtime. I used the statement error_reporting(0);
but it dosen't work for my version, it tried the solution proposed by the following question php error reporint but it doesen't work. I think another version is used here.
My php version is php 5.6.3. I have checked the php doumentation for a soltion but I couldn't find an answer.
How can I solve this ?
A semicolon is missing at the end of the second line of code
echo $var = 'hex'
This is the cause of the error and this is a compile error, not a runtime error. Because it cannot be compiled successfully, the script is not started at all. There is no runtime, the script never ran.
There is no way to suppress compile errors. Their purpose is to show the programmer that the script cannot be compiled and why.