Seeing the exit() PHP documentation got me thinking:
$filename = '/path/to/data-file';
$file = fopen($filename, 'r')
or exit("unable to open file ($filename)");
Couple questions:
- What are common use cases besides opening files for using
exit()? - Since not every function everyone ever writes ends in
exit(), how do you know to use it in some contexts vs. others? - Are
if/elseandor/exitinterchangeable?