PHP Flashcards
What does fmod() do?
Floating Modulus returns the modulus of a floating point number. number1 % number2.
What is the syntax for floating point modulus?
fmod($x, $y)
- x will be divided by y
What does XOR do?
Evaluates to true if one and only one condition is true.
What is || and how else can it be written?
It checks if at least 1 condition is true and if so returns true it can also be written as OR
What does && and how else can it be written?
Checks if both conditions are true and if so evaluates to true if one condition is false than then it evaluates to false. it can also be written as AND
What is a ternary operator?
A short hand for writing if constructs.
What is the syntax of a ternary operator?
$x = (CONDITION) ? TRUEBLOCK : FLASEBLOCK
What is a constant?
Constants are basically variable that can’t be redefined.
What is the syntax for creating a constant?
define(‘CONSTANT_NAME’, ‘CONSTANT_VALUE);
What is the php syntax for an array?
$x = array(item1, item2, item3,);
What is the shorthand syntax for an array and when can it be used?
$x = [item1, item2, item3,]; and it can be used as of php 5.4.
What is a statement?
A statement is the the shortest piece of code that communicates a complete thought.
When is the semicolon used?
At the end of a statement. It acts like a period.
what does strlen( ) do?
It will give you the length of the string that is passed to the function.
what does substr( ) do?
Selects a piece of a string. It is first passed a string, then a start point and the number of characters to return. i.e. substr(“Hello” 0, 3);
Would print “Hel”