Hướng dẫn php exit vs return
I would like to know in the following case which is a better option: Show In the PHP script, if the Case I:
Case II:
Case III:
Which of the three (3) options above is the best?
nyedidikeke 6,2127 gold badges43 silver badges53 bronze badges asked Aug 14, 2010 at 15:49
Since you are using The difference in this case will appear if your file is called through answered Aug 14, 2010 at 15:57
AzizAziz 19.3k6 gold badges61 silver badges69 bronze badges I would tend to go with the answered Aug 14, 2010 at 15:57
Jeffrey BlakeJeffrey Blake 9,5196 gold badges42 silver badges65 bronze badges It depends...if your script is intended to do nothing else but output a message, and you don't want the script to do anything afterwards, exit() will work. Otherwise, use return. answered Aug 14, 2010 at 15:58
Crayon ViolentCrayon Violent 31.6k5 gold badges53 silver badges78 bronze badges Exit terminates the program like die(). manual answered Aug 14, 2010 at 15:58
IznogoodIznogood 12.1k3 gold badges25 silver badges44 bronze badges dievà exit(các chức năng tương đương )
|