In PHP, if I have one function that calls another function; is there any way to get the called function to exit the caller function without destroying the whole script?
For example, let's say I have code like:
<?php
function funcA() {
funcB();
echo 'Hello, we finished funcB';
}
function funcB() {
echo 'This is funcB';
}
?>
<p>This is some text. After this text, I'm going to call funcA.</p>
<p><?php funcA(); ?></p>
<p>This is more text after funcA ran.</p>
Unfortunately, if I find something inside funcB, which is why I want to stop funcA from completing, I seem to need to exit the entire PHP script. Is there any way around this?
I understand that I could write something in funcA () to check the result from funcB (), but in my case I do not control the contents of funcA (); I only control the contents of funcB ().
; WordPress. get_template_part() WordPress / locate_template(), .
- ?