Given a php.ini setting of
default_charset = utf-8
what will the following code print in the browser?
header('Content-Type: text/html; charset=iso-8859-1');
echo '✂✔✝';
Suggested Answer: A
Get Premium 200-710 Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
38 comments · newest first
EV
Evette
11 months ago
Wait, so it could print unreadable text? That's wild!
RI
Rikki
11 months ago
Totally agree, A is the right choice!
MO
Mose
11 months ago
I think it might actually be B, though.
AL
Aleisha
11 months ago
Not sure about A, could be a blank line instead.
TH
Thurman
12 months ago
A will print the characters if the browser supports it.
TE
Teddy
12 months ago
I thought that if the charset doesn't match, it might just print the HTML entities as text, so maybe option B?
CA
Casie
1 year ago
I'm not entirely sure, but I feel like the output could be the Unicode characters or something strange, depending on the browser's handling of the charset.
AR
Aretha
1 year ago
I remember practicing a similar question where charset mismatches led to unreadable text. Could it be option A?
ST
Stephaine
1 year ago
I think the `header` function sets the content type to ISO-8859-1, which might cause issues with the UTF-8 characters.
LA
Lanie
1 year ago
I'm pretty confident I know the answer to this one. The Unicode characters will display as unreadable text in the browser because the charset specified in the header() function doesn't match the default charset set in the php.ini file.
HE
Heike
1 year ago
Okay, I think I've got this. The php.ini setting of default_charset = utf-8 means that any text output will be in UTF-8 by default. But the header() function is overriding that and setting the charset to iso-8859-1. So the Unicode characters will likely not display correctly.
SH
Shenika
1 year ago
Hmm, I'm a bit confused by this. The question is asking about the interaction between the php.ini setting and the header() function, right? I'll need to make sure I understand that properly.
ST
Stefan
1 year ago
This looks like a tricky one. I'll need to think carefully about how the charset settings interact with the output.
ED
Edelmira
1 year ago
I'm going with B. The header function clearly specifies ISO-8859-1, so the Unicode characters should display correctly. Easy peasy!
MI
Mignon
1 year ago
User4: Easy peasy!
EM
Emiko
1 year ago
User3: So, the Unicode characters should display correctly.
PE
Peggie
1 year ago
User2: I agree, the header function specifies ISO-8859-1.
EV
Evangelina
1 year ago
User1: I think it will display three Unicode characters.
SE
Serita
1 year ago
Woah, this question is really testing our understanding of character encoding. I hope the exam has more questions about emojis and cat pictures, that would be much easier!
CH
Cheryl
2 years ago
Hold on, isn't the PHP.ini setting of 'default_charset = utf-8' just a default? Wouldn't the 'header()' function take precedence and override that?
KE
Kerry
1 year ago
B) The 'header()' function will override the default charset setting
SA
Sabina
1 year ago
B) ✂✔✝
NI
Nieves
1 year ago
A) Three Unicode characters, or unreadable text, depending on the browser
AL
Alethea
2 years ago
Hmm, I'm not sure. Wouldn't the charset mismatch cause a blank line? The browser might not know how to handle the Unicode characters.
KR
Kristian
1 year ago
A) Three Unicode characters, or unreadable text, depending on the browser
WI
Winfred
1 year ago
B) ✂✔✝
EU
Eun
1 year ago
A) Three Unicode characters, or unreadable text, depending on the browser
LO
Lorriane
2 years ago
The output will definitely be the three Unicode characters, regardless of the browser. That's the correct answer, right?
LI
Lindsay
1 year ago
A) Three Unicode characters, or unreadable text, depending on the browser
MI
Miss
1 year ago
The output will definitely be the three Unicode characters, regardless of the browser. That's the correct answer, right?
EN
Ena
1 year ago
B) ✂✔✝
RO
Ronnie
1 year ago
A) Three Unicode characters, or unreadable text, depending on the browser
MA
Maryann
1 year ago
A) Three Unicode characters, or unreadable text, depending on the browser
CA
Carlota
1 year ago
B) ✂✔✝
TO
Torie
1 year ago
A) Three Unicode characters, or unreadable text, depending on the browser
RE
Renay
2 years ago
I agree with Rickie, it might not display correctly because of the charset difference.
RI
Rickie
2 years ago
I believe it will show unreadable text due to charset mismatch.
WH
Whitley
2 years ago
I think it will print three Unicode characters.