News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

DevShed:
Classes as PHP Functions
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.

0 comments voice your opinion now!
classes functions methods properties tutorial part2 classes functions methods properties tutorial part2


blog comments powered by Disqus

Similar Posts

WeberDev.com: PHP 101 (part 14): Going To The Polls

Content with Style Blog: A caching pattern for models

DevShed: Working with Multiple Document Nodes with the DOM XML Extension in PHP 5

Jeremy Kendall: API Query Authentication With Query Auth

Sudheer Satyanarayana's Blog: XML RPC Client Using PHP PEAR - A Real World Example: Ping Technorati


Community Events





Don't see your event here?
Let us know!


laravel tool composer framework introduction language symfony artisanfiles security version conference release opinion podcast interview community library voicesoftheelephpant series list

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework