Since you are using exit
and return
within the global scope (not inside a function), then the behavior is almost the same.
The difference in this case will appear if your file is called through include()
or require()
. exit
will terminate the program, while return
will take the control back to the calling script (where include
or require
was called).