Re: Email Handling and Manipulation Question 13

12 views
Skip to first unread message

Dan Kelly

unread,
Jul 19, 2011, 1:19:25 PM7/19/11
to Zend Certification Study Group
How would you manipulate an array so that it can be sent as an
attachment to an e-mail and
then reconstructed when the e-mail is received?

A. By transforming it into a string with serialize() and then encoding
it with
htmlentities()
B. By saving it to a file and then encoding it with base64_encode()
C. By transforming it into a string with serialize()
D. By transforming it into a string with serialize() and encoding it
with base64_encode()
E. By saving it to a file and then encoding it with convert_uuencode()

Seal Trip

unread,
Jul 19, 2011, 7:10:25 PM7/19/11
to zend-certificat...@googlegroups.com
Well if we need to transform the array data structure serialise is obvious. It is just a matter of what order... 
Since we know the emails will contact mostly numbers, characters and text this can act as a white list filter so there is no need for html entities

So I choose, D.

Alex Stetsenko

unread,
Jul 20, 2011, 2:19:33 PM7/20/11
to zend-certificat...@googlegroups.com
Why D? Isn't attachment == create file?
If so file is mentioned only in B and E. B makes more sense to me, the wording is blurred though. For instance I am assuming 'saving it to a file' means ' transforming it into a string with serialize()' and then writing to a file.

Seal Trip

unread,
Jul 20, 2011, 2:33:05 PM7/20/11
to zend-certificat...@googlegroups.com
My only concern with b, I don't know if MTA can deal with arrays. I will check and get back

Dan Kelly

unread,
Jul 22, 2011, 8:30:36 AM7/22/11
to Zend Certification Study Group
Serializing an array is the correct way of transforming it into a
string—the first step towards
making it transportable across the e-mail network. Next, you’ll need
to encode it so that it
can be safely sent across; the easiest way to do so in PHP 4 is to use
the base64_encode
function, which transforms it into a format that only uses 7 bits per
character. Therefore,
Answer D is correct.
Reply all
Reply to author
Forward
0 new messages