Useful PHP Functions we need to know
1. Require, Include and _once
The Difference :
include() will attempt to include the file, but if it fails PHP will just produce a warning, and continue to execute the script (as best it can) regardless. This is safer if you nonchalantly include files regardless of whether they are actually needed / exist.
require() will attempt to include the file, but fail with a fatal error should it have a problem when trying to get the file.Nice method, as the PHP will stop executing immediately and bug out if the file is not loaded correctly (for whatever reason).
include_once() / require_once() you should really try to avoid using. The benefits of using the _once method is that you know, for sure, that you’re not including the same file twice. However – this is much much slower than just writing semantic code and not relying on the fact you might have included the file more than once.
2. Sorting a Multidimensional Array
3. mysql_real_escape_string()
4. Forcing File Downloads
5. ob_gzhandler()
6. json_encode()
7. glob()
8. Ternary Operators
9. print_r()
10. Variable variables (double-dollar $$)
0 comments:
Post a Comment