开发者

Is there a way I can perform one PHP function first and then execute another function after the first function? [closed]

开发者_如何学Python It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

Is there a way I can perform one PHP function first and then execute another function after the first function?


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();
)

?


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(); }

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜