Wednesday, March 24, 2004

PHP 5 and SimpleXML

You'd be correct in guessing that there isn't a book out on PHP 5 and XML... thus, we'll revert to version 4 in this link! Whickety whack!Talk about simplicity. I was just reading over Andi Gutman's summary of new features in PHP 5. The Simple XML and SOAP examples struck me as indicative of PHP. Pure, unadulterated simplicity. No language on the planet (that I'm aware of, anyhow) reduces logic so dramatically.

From Andi's new book: Probably when looking back in a year or two it will be clear that SimpleXML has revolutionized the way PHP developers work with XML files. SimpleXML could really be called "XML for Dummies". Instead of having to deal with DOM or even worse SAX, SimpleXML represents your XML file as a native PHP object. You can read, write or iterate over your XML file with ease accessing elements and attributes.

Consider the following XML file:


<clients>
<
client>
    <
name>John Doe</name>
    <
account_number>87234838</account_number>
</
client>
<
client>
    <
name>Janet Smith/font></name>
    <
account_number>72384329</account_number>
</
client>
</
clients>


The following piece of code prints each client’s name and account number:

$clients = simplexml_load_file('clients.xml');
foreach (
$clients->client as $client) {
    print
"$client->name has account number $client->account_number";
}


SOAP: ...the following calls SomeFunction() defined in a WSDL file:

$client = new SoapClient("some.wsdl");
$client->SomeFunction($a, $b, $c);


What's New in PHP 5

Whither the Television Commercial?

TiVo Series2 80-Hour Digital Video RecorderFrom MIT's Technology Review Blog: a brief missive on the 'death of the TV commercial'.

Mailblaster is an online newsletter targeting those who do business with or have an active interest in what’s happening on Madison Avenue. More and more, the newsletter is focusing on alternatives to the 30- or 60-second commercial. They are predicting an evolution from zapping (that is, changing the channel to avoid commercials) to skipping (that is, using your digital video recorder to skim past commercials) to “opt-out“ (that is, being willing to pay extra to watch the show without commercials)...

...One recent article identifies a broad range of alternatives to traditional advertising that are being tested in what many see as an experimental period for the future of branding and marketing. Most of these involve some further blurring of the line between commercials and content, including product placements, programs based on ad campaigns, short interstitial movies, pop up ads on the bottom of your television screen, even the prospect of a whole channel devoted to content generated by a particular sponsor (if this seems unlikely, see if your local cable company is getting the Hallmark Channel, which mostly programs the four or five decades of content generated by the Hallmark Hall of Fame)...


That was so 30 seconds ago

GoogleFight

I would like to suggest the following GoogleFight matchups (hint: use double quotes around each phrase to get a more accurate 'punch count'):

Chevrolet Vega vs. Ford Pinto
Robert Parrish vs. Kevin McHale
Deviled Eggs vs. Potato Salad

GoogleFight

No comments: