Download presentation
Presentation is loading. Please wait.
Published byDeirdre Morris Modified over 9 years ago
1
More PHP…
2
Understanding Variable Scope The term scope refers to the places within a script where a particular variable is visible. The six basic scope rules in PHP are as follows: – Built-in superglobal variables are visible everywhere within a script. – Constants, once declared, are always visible globally; that is, they can be used inside and outside functions. – Global variables declared in a script are visible throughout that script, but not inside functions. – Variables inside functions that are declared as global refer to the global variables of the same name. – Variables created inside functions and declared as static are invisible from outside the function but keep their value between one execution of the function and the next. – Variables created inside functions are local to the function and cease to exist when the function terminates.
3
PHP Simple eCommerce Bob’s Auto Parts… – Retrieve HTTP_POST – Quick sanity check - if ($totalqty == 0) – Date() Function – Conditional Statement – Define() constant variables – Operator Precedence (calc tax rate) Why would this NOT work in an actual business?
4
PHP while Loops Freight calculator… Static vs dynamic table generation. Which way is better? Why?
5
PHP Better eCommerce… Same as Simple, BUT… With a flat file we can record orders and view them later. Some rants about flat files – Security! Is the setup that I have currently secure? – PHP File system Functions (http://us.php.net/manual/en/ref.filesystem.php) fopen(), flock(), fwrite(), fclose(), fgets(), fgetss(), fgetcsv(), feof()
6
PHP Better eCommerce What are some of the issues with using a flat file? Is there a time where flat files would be good to use? Is there anything better?
7
Mid Term Review HTML CSS JavaScript PHP
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.