Arnold Daniels' Blog: A dark corner of PHP: class casting
In this blog entryArnold 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.
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.
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.
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.