Is there a way I can perform one PHP function first and then execute another function after the first function?
func1();
func2();
You could always nest the function calls, so that the last step in function 1 is executing function 2. This is assuming, of course, that the execution of Function 2 ALWAYS follows Function 1.
That is, function1() { // do stuff; function2(); }
PHP executes code sequentially. If you have two function calls:
foo();
bar();
// more code
it will execute the lines in foo
sequentially, return to the line after that call (bar();
), and execute it, which will call bar
and execute its lines sequentially. Then bar
will return to the line after the bar();
call (// more code
) and execution will continue there
if (function1()) (
function2();
)
?