Outputting Data to the Browser Flashcards

1
Q

What three functions can be used to output data to the browser?

A
  1. print()
  2. echo()
  3. printf()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Write a plausible PHP print statement

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

Write a plausible echo statement

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

When should a programmer use the printf() statement?

A

The printf() statement is ideal when you want to output a blend of static text and dynamic information stored within one or several variables.

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

Write a plausible printf() statement

A

printf(“Bar inventory: %d bottles of tonic water.”, 100);

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

%b specifies…

A

binary number

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

%c specifies…

A

a character corresponding to a ASCII value

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

%d specifies…

A

a signed decimal number

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

%f specifies …

A

a floating-point number

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

%o specifies…

A

an octal number

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

%s specifies…

A

a string

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

%u specifies…

A

an unsigned integer

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

%x specifies…

A

a lower-case hexadecimal number

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

%X specifies…

A

an upper-case hexadecimal number

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

What’s the difference between printf() and sprintf()?

A

The sprintf() statement is functionally identical to printf() except that the output is assigned to a string rather than rendered to the browser.

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