click below
click below
Normal Size Small Size show me how
PHP - Week 1
WTWD 410 - Intro to PHP
| Term | Definition | Example |
|---|---|---|
| PHP Hypertext Preprocessor (PHP) | A widely-used open source scripting language especially suited for web development and can be embedded into HTML. | <?php echo "Hello, World!"; ?> |
| Database | An organized collection of structured information, or data, typically stored electronically in a computer system. | A MySQL database containing user information for a website. |
| Structured Query Language (SQL) | A standardized programming language used to manage relational databases and perform various operations on the data in them. | SELECT * FROM users WHERE age > 18; |
| Database Management System (DBMS) | Software used to store and manage databases. | MySQL, MariaDB, PostgreSQL, SQLite, and Oracle Database. |
| MySQL | An open-source relational database management system. | Connecting to a MySQL database using PHP. <?php $conn = new mysqli("localhost", "username", "password", "database"); ?> |
| PHP Statement | Instructions that PHP can execute, such as print or echo commands. | echo "This is a PHP statement."; |
| PHP Tags | Special tags used to write PHP code within HTML, typically <?php ... ?>. | <html><body><?php echo "This is PHP inside HTML!"; ?></body></html> |
| Variable | A storage location identified by a variable name that contains some known or unknown quantity or information, a value. | $name = "John"; |
| Comments | Text in the source code that is not executed but is used to provide explanations or annotations. | // This is a single-line comment /* This is a multi-line comment */ |
| Case Sensitivity | PHP variable names are case-sensitive, meaning $Var and $var would be considered different. | $Var = "Uppercase"; $var = "Lowercase"; echo $Var; // Output: Uppercase echo $var; // Output: Lowercase |
| Data Types | Classification of data items such as integer, string, float, etc. | $string = "Hello"; $integer = 42; $float = 3.14; $boolean = true; |
| String | A sequence of characters used to represent text. | $greeting = "Hello, World!"; |
| Integer | A whole number, positive or negative, without decimals. | $number = 100; |
| Float | A number that has a decimal point. | $pi = 3.14; |
| Boolean | A data type with two possible values: true or false. | $isAdmin = true; |
| Array | A data structure that can hold multiple values at the same time. | $fruits = array("Apple", "Banana", "Cherry"); |
| Object | An instance of a class containing data and methods related to that data. | class Car { public $make; public $model; function set_make($make) { $this->make = $make; } } $myCar = new Car(); $myCar->set_make("Toyota"); |
| NULL | A special value indicating that a variable has no value. | $value = NULL; |
| Echo Statement | A PHP statement used to output one or more strings. | echo "Hello, World!"; |
| Conditional Statement | Statements that perform different actions based on whether a certain condition is true or false, such as if statements. | if ($age >= 18) { echo "You are an adult."; } else { echo "You are a minor."; } |
| Concatenate | To link together or combine strings. | $firstName = "John"; $lastName = "Doe"; $fullName = $firstName . " " . $lastName; |
| Function | A block of code that can be repeatedly called to perform a specific task. | function greet($name) { return "Hello, " . $name; } echo greet("Alice"); |
| Constants | Identifier for a simple value that cannot change during the execution of the script. | define("SITE_NAME", "My Website"); echo SITE_NAME; |
| Operators | Symbols that tell the PHP processor to perform specific actions, such as arithmetic operations. | $sum = 2 + 3; |
| Operands | Values or variables on which operators perform operations. | $a = 5; $b = 10; $sum = $a + $b; // $a and $b are operands |
| Assign | The operation of assigning a value to a variable, typically using the = operator. | $age = 25; |
| Sum | The result of adding two or more numbers. | $total = 5 + 10; // Sum is 15 |
| Quotient | The result of dividing one number by another. | $quotient = 10 / 2; // Quotient is 5 |
| Modulus | The remainder of a division operation. | $remainder = 10 % 3; // Remainder is 1 |
| Increment | Increasing a number by a set amount, often by 1. | $count = 0; $count++; // Increment by 1 |
| Decrement | Decreasing a number by a set amount, often by 1. | $count = 10; $count--; // Decrement by 1 |
| Logical Operators | Operators used to combine conditional statements, such as && (and), || (or), and ! (not). | if ($age > 18 && $age < 65) { echo "You are an adult."; } |
| Loop | A sequence of instructions that repeats until a certain condition is reached. | for ($i = 0; $i < 10; $i++) { echo $i; } |
| Switch Statement | A control statement that allows a value to change control of execution. | $day = "Monday"; switch ($day) { case "Monday": echo "Start of the work week."; break; case "Friday": echo "End of the work week."; break; default: echo "Midweek day."; } |
| Super Global Variable | Built-in global arrays in PHP, such as $_POST, $_GET, $_SESSION, etc. | $_POST['username']; $_GET['id']; $_SESSION["email"] |