PHP

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

comparison operators are?

not equals to, equals to, !=, <>, ==, === , >, <

In PHP, all keywords (e.g. if, else, while, echo, etc.), classes, functions, and user-defined functions are or are not case-sensitive?

NOT case sensitive; i.e. "echo", "ECHO", "EcHo"

T or F A string is series of characters, where a character is the same as a byte.

True

T or F: A constant is an identifier (name) for a simple value. As the name suggests, that value cannot change during the execution of the script. A constant is case-sensitive by default. By convention, constant identifiers are always uppercase.

True

passing by value means what

an arguments value is not effected at all by the arguments outside of the functions scope

closures are ______

anonymous functions with no name that are capable of accessing variables outside of the function scope

the ".=" dot equals means

append

Sometimes if an argument is not passed through, and you want it to have a starting value, no matter what, this is where a _____ argument will come to your assistance.

default

constants do what?

display data that never changes

the == sign is asking if something is _____ while the === sign is asking if something is _____

equal, identical

How would you structure a for loop?

for() { } example for($counter =0; $counter < 20; $counter++){ echo "<li>" . $counter . "</li>" }

how do you use the foreach?

foreach($names as $name){ echo $name }

how you do you create a construct inside of a class

function __construct() { print "In BaseClass constructor\n"; }

how do you create a function

function hell() { input anything inside this function } then call the function

how do you format an "if" statement

if(condition){ code you want to run }

the if else statement looks like

if(condition){ code you want to run }elseif(?){ } else { }

what is concatenation and what does it do?

it is a "dot" and allows us to put together two strings, ie "hello". "world" = "helloworld"

what goes into arrays? ____ and ___

keys and values

unary operatory means it has how many operators?

one (ex +, -, >, etc)

__________ are symbols that help us modify data values

operators

a variable inside a defined class {} is called a

property

how do you define a public property?

public $var6 = myConstant; public $var7 = array(true, false);

properties inside of a class are defined in 3 distinct categories

public, protected, or private

What keyword do we use to return data from our functions to be stored, perhaps in a variable.

return

print_r is ______ only

structure

var_dump is _______ and ______

structure and types

What keyword or method can we use to pass a value into a closure or anonymous function?

the 'use' keyword

how do you call a function in PHP?

the function name and parenthesis, for example: hello()

how do you define a class in PHP?

the keyword class, followed by a class name, followed by a pair of curly brackets, inside the curly brackets could include variables (called properties) or functions called methods

ternary operators tell us something has how many operators?

three ( = = =)

True or False, Booleans are used when you need no grey area?

true

anything in double quotes is parsed how many times?

twice, this typically means that it will be slower

binary operators tell us something has how many operators?

two (ex >=, =<,)

Associative arrays allow us to what

use a string as a key, rather than just intervals

a function inside a class {} is known as a

method

logical operators work like comparison operators but use words like

"and" and "or" to give us even more flexibility when comparing values.

variables in PHP are defined using a ___ sign

$ Dollar Sign

What is the correct way to pass an argument to a variable function?

$func('Exaple');

Given the following variable $func = 'print_info'; How would I call print_info as a variable function?

$func()

the incremental and decremental operators add or subtract an additional int onto your current variable does what?

++ this would take 100 and put it into 101 OR -- would take 100 and make it 99

arithmetic operators

+, -, *, /

How can you comment out something in PHP?

// or /** **/

A PHP Script starts with a ______ and ends with a_____

<?php ?>

All variable names are or are not case-sensitive?

ARE case sensitive -Only the first statement will display the value of the $color variable (this is because $color, $COLOR, and $coLOR are treated as three different variables):


Ensembles d'études connexes

Purines and pyrimidines.........

View Set

Which of the following defines business ethics? An approach toward decision making in which a person evaluates moral principles Professional standards of conduct, based on moral principles and values, guiding decision-making and actions Choices made ba

View Set

CISC 310 Ch 1, 2, 3, 7, 8, 10, 12, 13, 14, 15, 16, 17

View Set

Le nouveau quartier français 1 - Rallye 1 - Circuit rouge 1

View Set