RSS DAILY NEWS TICKER EXAMPLE


home > overview

C7Y: Late Static Binding: a practical example




Sean Coates has posted a new article today about one of the features that will be included in the next major release of PHP (5.3) - late static bindings.

Late Static Binding (LSB) is a topic that's been brought up numerous times in the past three years in various PHP development discussion circles (and we're finally getting it in PHP 5.3)â€"but what does it really do, and why should you care? Here's a simple practical example of how it can greatly simplify your code's design.

He shows its usefulness in an example of how it works, letting classes/objects access static methods, constants and properties of inherited classes (besides their own). His example (using beer, of course) shows how an extended class (Ale) can reference the constant (NAME) in the parent class (Beer). Thanks to a new keyword in PHP 5.3 - "static::" - helps define the difference even clearer.

Check out the rest of the article for a more practical usage too.




click here to see original article or to find similar articles

 RSS DAILY HEADLINES

HEADLINES

Poll: Partisanship sways opinions on PalinRepublicans and Democrats have deeply contrasting first impressions of Republican vice presidential nominee Sarah Palin, suggesting partisanship, not gender, is paramount in the initial public reviews.

Briefing Book! Barack-O and Bill-O Sit Down to Chat


At least 18 dead in Cairo rockslide (AFP)

People search for survivors under the rubble of homes at the site of a massive rockslide at Moqattam hill in northern Cairo. At least 18 people were killed and 22 injured when dozens of homes collapsed after being hit by the rockslide, Egyptian emergency services said.(AFP/Khaled Desouki)AFP - At least 18 people were killed and 22 injured on Saturday when dozens of homes in northern Cairo collapsed after being hit by a massive rockslide, Egyptian emergency services said.



Find this article in Google