RSS DAILY NEWS TICKER EXAMPLE


home > overview

Arnold Daniels' Blog: A dark corner of PHP: class casting




In this blog entry Arnold Daniels talks about an issue he had in the past (needing a bit more functionality than the PEAR DB library could offer) and how he ended up solving it with what he calls a "dark corner" of PHP - class casting.

PHP has a function serialize, which can create a hash from any type of variable, scalars, array, but objects as well. Using the unserialize function, PHP can recreate the variable from the serialized hashed. If we look at how an object is serialized, we see only the properties and the class name are stored.

His method allows for class manipulation via changes to the serialized class information (like changing the value of the name parameter). His "casttoclass()" function makes changing this value simple.




click here to see original article or to find similar articles

 RSS DAILY HEADLINES

HEADLINES

Edwards to emerge from seclusion for speech

Aug. 9: Jennifer Palmieri, former staffer for John Edwards tells NBC's Jenna Wolfe that Elizabeth Edwards knew about her husband's affair since 2006, and is relieved the news is now public. (Today Show)In a return to the public stage, John Edwards has confirmed plans to talk politics a month after admitting to an extramarital affair. But his wife won't be at his side.


Australian police clear Indian doctor of involvement in terror (AFP)

Indian doctor, Mohamed Haneef, at a press conference in Bangalore in early August. Australian police have cleared Haneef of involvement in failed bomb attacks in Britain last year after a bungled 14-month probe(AFP/File/Dibyangshu Sarkar)AFP - Australian police have cleared an Indian doctor of involvement in failed bomb attacks in Britain last year after a bungled 14-month probe that is now the subject of a judicial inquiry.


Consumer spending flags, but confidence rises (Reuters)

A shopper walks past a store display in New York July 1, 2008. (Lucas Jackson/Reuters)Reuters - Personal income tumbled unexpectedly in July and inflation-adjusted spending shrank as government economic stimulus waned, but consumer spirits rose this month, a hint the economy may muddle through its woes.



Find this article in Google