PHP (pop) final exam
1) Explain the difference between NULL, 0, '', '0', and FALSE. Then explain why weak typing, although designed to make coding easier, actually makes it harder by causing you to have to look up every boundary case.
2) You need to parse an XML document and place elements of it into PHP objects and/or arrays. Should you use xml_parse, DOM, DOMXML, XML_Parser, XML_Tree, or XML_Unserializer? For the three that are not officially part of PHP, be sure to account for the corresponding lack of documentation (except the claims that the package allows you to parse XML "without having to use the DOM", which in the end would probably be easier) when making your decision.
3) Having only one type of array (associative arrays, or dictionaries) makes the syntax simpler, makes the language slightly easier to learn, and turns every bit of code that wants indexed arrays into an ugly hack. Is this trade-off worth it? Why or why not?
Bonus) Compose three more questions in the same vein as the three on this exam. Explain why this bonus question is essentially a gimme.
[The background here is that I just finished my first large-scale project in PHP: the Nearest Neighbor News Network. It's an RSS aggregator that uses collaborative filtering techniques to recommend news articles... so if you're into blog and community sites, you may find it interesting. And now I'm ready to go back to the happy Python world where (wo)men are (wo)men and the object system isn't a joke.]
2) You need to parse an XML document and place elements of it into PHP objects and/or arrays. Should you use xml_parse, DOM, DOMXML, XML_Parser, XML_Tree, or XML_Unserializer? For the three that are not officially part of PHP, be sure to account for the corresponding lack of documentation (except the claims that the package allows you to parse XML "without having to use the DOM", which in the end would probably be easier) when making your decision.
3) Having only one type of array (associative arrays, or dictionaries) makes the syntax simpler, makes the language slightly easier to learn, and turns every bit of code that wants indexed arrays into an ugly hack. Is this trade-off worth it? Why or why not?
Bonus) Compose three more questions in the same vein as the three on this exam. Explain why this bonus question is essentially a gimme.
[The background here is that I just finished my first large-scale project in PHP: the Nearest Neighbor News Network. It's an RSS aggregator that uses collaborative filtering techniques to recommend news articles... so if you're into blog and community sites, you may find it interesting. And now I'm ready to go back to the happy Python world where (wo)men are (wo)men and the object system isn't a joke.]
