Copy of COMPROG 3 Reviewer.pdf
Document Details
Uploaded by SoftBougainvillea
Full Transcript
Computer Programming 3 Grade 12 | First Semester Consist of multiple layers of Lesson 1 - Introduction to Web Development security Getting Started with PHP 11. Web Servers Support Behind PHP...
Computer Programming 3 Grade 12 | First Semester Consist of multiple layers of Lesson 1 - Introduction to Web Development security Getting Started with PHP 11. Web Servers Support Behind PHP Compatible to all local servers Rasmus Lerdorf in 1994 such as apache, netscape, Appeared in market in 1995 microsoft etc Latest PHP ver. 7.4.0 in Nov. 28 12. Helpful PHP Community Large community with PHP documentation… PHP: Hypertext Preprocessor Can be embedded to HTML Server-Side Object-oriented language 1. Web browser sends HTTP request Interpreted language 2. Processes PHP to generate HTML Server-side scripting language document Open-source scripting language 3. Web server responds with HTML Faster than ASP and JSP document back to the web browser Can control user to access some pages Handles forms - registration form Front-End Technologies 1. HTML - static web page Protocols: 2. CSS - designs web pages HTTP, POP3, SNMP, LDAP, IMAP 3. JavaScript - interactive website 4. Ajax Features of PHP 5. XML and JSON 1. Performance 6. jQuery Faster processing speed and better performance Two Types of the Purpose of Programming 2. Open Source Languages Free to download and to use 1. Domain-Specific 3. Familiarity with Syntax Used in specific application Understandable syntax domains 4. Embedded 2. General-Purpose Easily embed to HTML tags and Can develop in various script applications 5. Platform Independent Available on Windows, Mac, Linux PHP is a General Purpose language. and Unix OS 6. Control Two Main Applications Can do long script/code in few 1. Server-Side Scripting lines of code Well-suited for dynamic websites 7. Database Support and web applications Supports MySQL, SQLite, ODBC 2. Command-Line Scripting and etc. You can run PHP script from the 8. Loosely Typed Language command line to perform No need to declare data type administrative tasks. 9. Error Reporting Predefined error Advantages of PHP 10. Security Simple - easy to learn Fast | AY 2024-2025 Computer Programming 3 Grade 12 | First Semester Stable ○ No return value Open source and free ○ Can pass multiple strings Community support separated by comma (,) ○ Faster than print statement Installing PHP Print Required Softwares ○ Language construct 1. PHP ○ A statement 2. Web server that supports PHP - Apache ○ With or without parenthesis 3. Database server - MySQL ○ Returns 1 ○ Can’t pass multiple strings Installation of PHP ○ Slower than echo statement WAMP - Windows LAMP - Linux Statements MAMP - Mac Consists of one or more statement SAMP - Solaris Always ends with a semicolon (;) FAMP - FreeBSD Two types of statements: XAMPP ○ Simple ○ Cross, Apache, MySQL, PHP, Perl ○ Compound - uses curly brackets to mark a block of code XAMPP Control Panel Don’t need to place semicolon in the last Modules Found: statement of PHP Block Apache MySQL Whitespace and Line Breaks FileZilla Does have no special meaning in PHP Mercury Still equivalent to each other Tomcat Lesson 3 - Variables and Constant Lesson 2 - Introduction to Web Development Variables PHP Fundamentals $variable (single dollar) and contains: PHP Syntax ○ Alphanumeric and underscore Like HTML, you need the opening tag to ○ Should start in letter or start PHP code underscore $$variable (double dollar) - reference - closing tag inside it Partially Case Sensitive Constants ○ Insensitive in PHP Constructs, 2 ways in defining constants: keywords, user-defined function ○ define() function and class names define(name, value, ○ Sensitive in variables case-insensitive) ○ const keyword Echo and Print const message = “1”; Echo echo constant() - function to print the ○ Language construct constant ○ A statement ○ With or without parenthesis Data Types echo() or echo Scalar (Pre-defined) - one value | AY 2024-2025 Computer Programming 3 Grade 12 | First Semester ○ Boolean Spaceship Returns: ○ Integer -1 if less ○ Float 0 if equal ○ String 1 if greater Compound (user-defined) - multiple values. Concatenation Add two strings ○ Array.= Concatenation ○ Object and Assignment Special Types ○ Resource PHP Control Structures/Statements ○ Null If Else-if var_dump() If-else-if To display its type and value Nested if Switch statement Comments // Lesson 5 - Control Structures # Looping - for multi-line comments for (start; condition; increment) { statement; Lesson 4 - PHP Operators } PHP Operators for (start; condition; increment): statement; Operators: endfor; Arithmetic while (expression) { Assignment statement; Bitwise } Comparison while (expression): Increment/Decrement statement; Logical endwhile; String do { Array statement; Type } while (expression); Execution Error Control Jumping Statements Break *Some are not included, use common sense ○ Ends the loop Op Name Function Continue ○ Skips the iteration % Modulus Remainder ** Exponentiation === Identical Same value Same data type !== Not Identical Not same value Not same data type Not Equal The same with != | AY 2024-2025