Language features Flashcards

1
Q

echo

A

outputs strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

.

A

concatenation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

$var

A

php variable declaration requires $ at the front

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

$array

A

arrays are declared by creating a variable, newing up an array, and passing args.

$array = array(“Egg”, “Tomato”, “Bacon”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

array_push

A

adds to array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

unset()

A

removes an item from array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

strlen()

A

length of a string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

substr()

A

part of a string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

strtoupper()

A

uppercase a string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

strtolower()

A

lowercase a string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

strpos()

A

gives the first occurence of a character in a string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

round()

A

rounds to nearest whole number

OPTIONAL: pass number of places to round to

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

join(glue, array)

A

joins an array into a string, with “glue” chars

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

sort()

A

sorts an array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

rsort()

A

reverse sorts an array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

public function __construct()

A

php class constructor function

17
Q

is_a()

A

object method to test if an object is an instance of a class
(first arg is obj we’re checking, second is class)

18
Q

property_exists()

A

check if an object has a given property (first arg is obj we’re checking, second is prop)

19
Q

method_exists()

A

see if an object has a given method (first arg is obj we’re checking, second is method)

20
Q

extends

A
keyword for inheritance
i.e. class Square extends Shape {}
21
Q

final

A

keyword to prevent parent class methods from being overridden by its children

22
Q

const

A

constant variables
does not start with $
accessed via scope resolution operator
i.e. echo Ninja::stealth;

23
Q

static

A
lets you use a class property or method without having to create an instance of that class.
i.e.	King::proclaim();
24
Q

associative array

A

‘key’ => ‘value’ pair

aka a dictionary

25
Q

multidimensional array

A

array of arrays

26
Q

::

A

scope resolution operator

allows access to static, constant, and overridden props or methods of a class

27
Q

->

A

access object member (props or methods)

equivalent to “.” in C# or JS