03 Intro to PHP

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What are *VARIABLES*?

Is a storage location paired with an associated symbolic name (an identifier), which contains some known or unknown quantity of information referred to as a value. In PHP, are represented by a dollar sign followed by the name of the variable. $myName; $x; $day;

Describe the different types of PHP *LOOPS*

Often when you write code, you want the same block of code to run over and over again in a row. Instead of adding several almost equal code-lines in a script, we can use loops to perform a task like this. In PHP, we have the following looping statements: *while - loops* through a block of code as long as the specified condition is true *do...while - loops* through a block of code once, and then repeats the loop as long as the specified condition is true *for - loops* through a block of code a specified number of times *foreach - loops* through a block of code for each element in an array

Describe what a *WHILE LOOP* is, and when it would be used.

The meaning of a while statement is simple. It tells PHP to execute the nested statement(s) repeatedly, as long as the while expression evaluates to TRUE. The value of the expression is checked each time at the beginning of the loop, so even if this value changes during the execution of the nested statement(s), execution will not stop until the end of the iteration. It is possible for the loop to never run because the condition never evaluates to TRUE.

How *Exclusive Or* works

xor returns a TRUE value IF either value is TRUE, but a FALSE value if both inputs are TRUE or both inputs are FALSE

List all of the *ARITHMETIC* operators

+ Addition $j + 1 - Subtraction $j - 5 Multiplication $j * 3 / Division $j / 2 % Modulus $j % 9 ++ Increment ++$j -- Decrement --$j

List all of the *ASSIGNMENT* operators

= += -= *= /= .= %=

List all of the *COMPARISON* operators

== Is equal to != Is not equal to > Greater than < Less than >= Greater than or equal to <= Less than or equal to

List the types of Common Operators in PHP

ARITHMETIC ASSIGNMENT COMPARISON RELATIONAL **** ARRAY BITWISE EXECUTION INCREMENT/DECREMENT STRING

What is an *EXPRESSION*?

An expression is a combination of values, variables, operators, and functions that result in a value. $y = 3 * (abs ( 2 * $x) + 4);

What are *Operators*?

Programming languages typically support a set of operators: constructs which behave generally like functions, but which differ syntactically or semantically from usual functions.

List all of the *LOGICAL/RELATIONAL* operators

Relational operators test two operands and return a Boolean result - either TRUE or FALSE. The three types of relational operators are: *EQUALITY* *COMPARISON* *LOGICAL* && and and low-precedence and || or or low-precedence or ! Not xor Exclusive or

What is *VARIABLE SCOPE*?

The scope of a variable is the context within which it is defined. For the most part all PHP variables only have a single scope. In PHP, the following types of variable scope concepts exist: *LOCAL VARIABLES* are variables that are created within, and can be accessed only by, a function (cannot be accessed by non-function code) *GLOBAL VARIABLES* are variables that are declared using the *global* keyword. they are accessible by all of your code. *STATIC VARIABLES* A static variable exists only in a local function scope, but it does not lose its value when program execution leaves this scope. The static variables value is only initialized in the first call of function and every time the function is called thereafter, the value will still hold from the previous call. Also, you cannot assign an expression to a static variable

What is a *STATEMENT*?

When an *assignment* or a *control-flow* construct is combined with and *expression* the result is a *STATEMENT* <?php $daysToNewYear = 366 - $dayNumber; //Expression if ($daysToNewYear < 30) { echo "Not long till New Year"; //statement } ?>

Using Logical Operators and Comparison Operators

You generally use a logical operator to combine the results of two of the comparison operators. if ($hour > 12 && $hour < 14) doLunch();

What is an *Operand*, and what are the *Types*?

an operand is the part of a computer instruction that specifies data that is to be operating on or manipulated and, by extension, the data itself. Basically, a computer instruction describes an operation (add, subtract, and so forth) and the operand or operands on which the operation is to be performed Unary Binary Ternary

What are *LITERALS*?

is a simple expression that evaluates to itself. $myName = "Nathan"


संबंधित स्टडी सेट्स

BUSI 601 Cost Accounting Chapter 2

View Set

A&P - Structure and Location of Body Cavities

View Set

Chapter 14 The Ferment of Reform and Culture 1790-1860

View Set

Biology B - 1. Genetics and Heredity / 10. Mendelian Genetics

View Set

MED SURGE w/L exam 3 study questions

View Set

Functions of the Large Intestine

View Set