One of the common debugging option still remains in PHP is to print the values in the browser using
var_dump() usually dumps all the related information about a variable or object on the same page where we call the var_dump. The key feature here to note is, it will not stop the execution of the script. That’s the same case with print_r() but the latter will not show the type of the variable. You can observe the difference in the below picture and code.
<?php $fruits = array( 'Apple'=>6, 'Kiwi'=>10, 'Orange'=>4 ); var_dump($fruits); echo "<br>I comes after fruits"; ?>
But Laravel developers are blessed with a different function to evaluate further, and that’s called
dd() or dump and die. You can use this helper function anywhere in the application, even this will work in the blade templates as well.
This function is considered a really cool debugging option with color-coded variables and objects, which is very readable and well-formatted.