 | News Feed |
Sections
|
| feed this: |  |
Matthew Weir O'Phinney's Blog: PHP 5's Reflection API
by Chris Cornutt October 09, 2006 @ 13:37:00
In his latest blog post, Matthew Weir O'Phinney shares some of his newfound love for the Reflection API that PHP5 brings to the table:
When I first read about the Reflection API in a pre-PHP 5 changelog, my initial reaction was, "who cares?" I simply failed to see how it was a useful addition to the language. Having done some projects recently that needed to know something about the classes they are using, I now understand when and how it can be used.
It shines when you need to work with classes that may not be defined when you write your code -- any code that dispatches to other classes, basically.
To emphasize the point, he lists a few things you can do with the API, including determine if a method exists in a class and instantiate an object instance with a variable number of arguments to the constructor. He also includes a code example, showing a simple method of getting all of the methods on a class.
voice your opinion now!
relfection api php5 classes object method code example relfection api php5 classes object method code example
DevShed: Using Inheritance, Polymorphism and Serialization with PHP Classes
by Chris Cornutt August 15, 2006 @ 09:02:43
Some concepts of object-oriented design are harder to figure out that others for a budding programmer. Thankfully, there's articles like this one from DevShed to help fill in some of the gaps. Specifically, they focus on inheritance, polymorphism, and serialization in your PHP classes.
If you are working with classes in PHP, you will sooner or later encounter inheritance, polymorphism, and serialization. The ability to use these three will help speed up your code writing. This article covers how to use them, and more.
First off, they look at inheritance and working with child classes before moving on to polymorphism (similar functionality, different objects), calling functions statically, and serializing objects to make passing them around much easier.
voice your opinion now!
classes object oriented polymorphism inheritance serialization tutorial classes object oriented polymorphism inheritance serialization tutorial
DevShed: Classes as PHP Functions
by Chris Cornutt August 09, 2006 @ 05:49:25
Continuing on in their "PHP functions" series today, DevShed has posted this next step up the ladder, getting more advanced with the functions they're working with. This time, there's a focus on functions inside classes and creating the classes around them (a sort of introduction to object-oriented programming).
Continuing our PHP functions article, we move on to creating classes. Let me say right at the start that you can write perfectly effective and useful PHP code without creating classes or going into object oriented programming. Object oriented programming can be very powerful and PHP programmers are increasingly taking advantage of these capabilities, which have been greatly expanded since PHP4.
They start with the creation of a simple class - a human class with two $legs and two $arms. They show a simple display of this data and add another attribute to the class, one for hair color. They then capture the output they've been creating inside a function, report, and show how to execute it. Finally, they show how to use the special function that runs when the object is created - the constructor.
voice your opinion now!
classes functions methods properties tutorial part2 classes functions methods properties tutorial part2
DevShed: Overloading Classes in PHP 5
by Chris Cornutt July 26, 2006 @ 05:53:51
DevShed is wrapping up their "Overloading in PHP" series today with this last part - "Overloading Classes in PHP5".
It's time to move on and continue exploring the subject, since there are still a few additional topics that need to be covered. So, what's comes next now? All right, in this last part of the series, I'll be explaining how to overload classes specifically in PHP 5, which offers native support for overloading class members and methods, without having to explicitly call the PHP built-in "overload()" function.
They look first at using the __get method to replace __set in their previous code to save data out to a file. Then, to illustrate even more enhanced functionality, they implement __get and __set at the same time in a class, using them to grab values and set values to properties. Finally, they throw __call into the mix, showing how to overload method calls too.
voice your opinion now!
overloading part3 tutorial classes php5 get set call overloading part3 tutorial classes php5 get set call
Justin Silverton's Blog: Flickr.com - PHP/mysql case study
by Chris Cornutt March 29, 2006 @ 07:16:58
Another very brief article has been posted by Justin Silverton today - this time, it's a "case study" of the hows and whys of Flickr using PHP/MySQL.
Carl Henderson from Flickr.com, a very popular photo blogging service has released a pdf (not sure exactly when this was actually released) detailing the issues they faced with having a high-traffic website.
Based on the original PDF, Justin pulls out some of the key points he noticed as he read. The top level items are "Classes, libraries, and systems used", "unicode support", "Why php was used", and "Mysql usage". He provides more of an outline for each item in the post, touching on the full contents of the formal case study.
voice your opinion now!
php mysql flickr case study classes unicode why php mysql flickr case study classes unicode why
|
Community Events
Don't see your event here? Let us know!
|