每日一题(16)
上一篇 /
下一篇 2007-10-27 03:19:01
/ 个人分类:每日一题
9.
What happens when a form submitted to a PHP scrīpt contains two elements with
the same name?
A.
They are combined in an array and stored in the appropriate superglobal array
B. The
value of the second element is added to the value of the first in the
appropriate superglobal array
C. The
value of the second element overwrites the value of the first in the
appropriate superglobal array
D. The
second element is automatically renamed
E. PHP
outputs a warning
Answer:
PHP simply adds elements to the
appropriate superglobal array as they are retrieved from the query string or
POST information. As a result, if two elements have the same name, the first
one will just be overwritten by the second. Therefore, Answer C is correct.
10.
How would you store an array in a cookie?
A. By
adding two square brackets ([]) to the name of the cookie
B. By
using the implode function
C. It
is not possible to store an array in a cookie due to storage limitations
D. By
using the serialize function
E. By
adding the keyword ARRAY to the name of the cookie
Answer:
Only Answer B is always correct.
While the implode function can be used to convert an array into a string in a
prerequisite of being able to store it in a cookie. it cannot guarantee that
you will be able to reconstruct the array at a later date the way serialize()
can. Storing an array in a cookie may not be a good idea because browsers only
allow a limited amount of storage space for each cookie, but that's not always
the case--you should be able to store relatively small arrays without much in
the way of problems.
相关阅读:
- 每日一题(6) (chenz1117, 2007-10-14)
- 每日一题(7) (chenz1117, 2007-10-16)
- 每日一题(8) (chenz1117, 2007-10-17)
- 每日一题(9) (chenz1117, 2007-10-18)
- 每日一题(10) (chenz1117, 2007-10-19)
- 每日一题(11) (chenz1117, 2007-10-21)
- 每日一题(12) (chenz1117, 2007-10-22)
- 每日一题(13) (chenz1117, 2007-10-23)
- 每日一题(14) (chenz1117, 2007-10-24)
- 每日一题(15) (chenz1117, 2007-10-25)
导入论坛
收藏
分享给好友
管理
举报
TAG:
每日一题