PHP will create your function regardless of the exit()
. Then, you call writeName()
before the exit();
so it behaves as expected. (outputs and dies)
try this:
<?php
echo "My name is ";
writeName();
exit();
echo 'I am still alive!';
function writeName() { echo "JEWEL AHMMED"; }
and the “I am still alive!” will not be output.
1
solved Explain the PHP code & exit() function [closed]