Asked 2026 years ago
30 Nov -0001
Views 1228
Patricia

Patricia posted

What is main difference Var_dump () die and exit () ?

What is main difference Var_dump () die and exit () ? what are they used for ?
sec8

sec8
answered Jul 20 '21 00:00

there is much of difference between var_dump , die or exit
on the other hand die and exit are almost similar functionality

var_dump()
var_dump() function used for the printing the value and type of the variable or array or objects in php


var_dump($test);

in above usage var_dump will print all detail about the $test variable


die()
die() function is used to print and stop execution of the php programm

suppose


$a=1;
die($a);
echo 'hello';


by running about code , it will print 1 , not printing 'hello' becuase it stop running all code after die() function


exit()
exit() work exatly same as die() but it stop the code running but exit() dont have facility to pass on anything to print before exit the code

exit and exit() both way it work same
Post Answer