How To Display Code Errors

It is must to display code errors while coding. It is the best weapon for programmer to find out why and where the errors happened?  We face errors often while developing a web application. Then it become more irretating to solve this problem. Sometime it took much time to find out the errors. It become hard time for a Web Application developer.
Here are some tips to find out the code errors
In Raw PHP

<?php
$variable =  "data. Is there any data or Not";

echo "<pre>" // to display error batter to understand use <pre> tag.
Print_r($variable);  //  Here show wheather there have any data error or not.
exit();   // use exit function for script end after display data error.

?>

In PHP you can also use die function to display data error.

<?php
 die("set data errors variable here")
?>

We can also use var_dump function to display code errors

<?php
   $c = true and false;
   var_dump($c);
?>

In laravel Framework there has own debug mode that is easier to display code errors.

Use it in php blade file :

@php
     $variable =  "data. Is there any data or Not";
    dd($variable );
@endphp

OR in php files:

<?php
    $variable =  "data. Is there any data or Not";
    dd($variable );
?>

In Javascript we can find error by console.log function. we can also use browser console option to find errors. Right click on mouse then click inspect and click on Console option.

<!DOCTYPE html>
<html>
<body>

<script>
var =  "data. Check is there any data or Not" ;
console.log(var );
</script>

</body>
</html>

We can also display code errors by window alert function in js files.

<script>
var =  "data. Check is there any data or Not" ;
	alert(var );
</script>

If you have any query comment bellow.

author Author: Robert Calixto

comments Commenting and subscribing are very important to us because they motivate us to keep producing content of the highest caliber that appeals to your needs and interests.