


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Professor: Wang; Class: File Structures and Database Systems; Subject: Computer Science; University: California State University - Fullerton; Term: Unknown 1989;
Typology: Exams
1 / 4
This page cannot be seen from the preview
Don't miss anything!



**
First PHP Example
Output"; echo "Output"; echo "Output
"; ?>**
**----------------------------------------------------------------
First PHP Example
OutputOutputOutput More PHP Output**
Executing SQL
Closing the Connection
Cleaning up: close the database connection
PHP data types
PHP Expressions and Operators
/ in PHP is always floating point division To get integer division, we must cast to int $x = 15; $y = 6; echo ($x/$y), (int) ($x/$y), ""; Output is 2.5 2 Inequality operators do not compare strings Will cast strings into numbers before comparing To compare strings, use the C-like string comparison function, strcmp()
PHP Control Structures
Close the block with endif, endwhile, endfor, endswitch Advantage to this syntax is readability Now instead of seeing a number of close braces, we see different keywords to close different types of control structures
Creating Arrays
Unlike Perl, arrays in PHP do not have a different prefix for the variable name. Thus you cannot have a scalar and an array with the same variable name at the same time However, you can test a variable to see if it is an array or not is_array() returns true or false