News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
feed this:

Alexander Netkachev's Blog:
Practical PHP events
October 24, 2006 @ 07:20:48

In his latest tutorial, Alexander Netkachev shows how to, with some of the simple PHP functions, create an event system for your script, complete with callbacks.

The way how events are raised and how listeners are attached on the events is a part of a core in many modern applications. It plays an important role in some enterprise design patterns (MVC, for example).

He starts with the basics of event handling - some of the terms and descriptions of basic functionality that any good event handler would have. He describes the most common setup of an event-interaction relationship. Then, it's on to the code, showing first three different ways to call functions (by name, by variable, and by callback).

He finishes it off with a functional example that responds to a a call to fireEvent (five times) and handles each by calling the function in the callback information (myFunction).

0 comments voice your opinion now!
event handline callback tutorial basics calling methods event handline callback tutorial basics calling methods



DevShed:
Finding Paths, Timestamps and More with the DirectoryIterator Class in PHP
September 18, 2006 @ 08:21:51

DevShed continues its look at the DirectoryIterator functionality in PHP5 with the second part of the series today - "Finding Paths, Timestamps and More with the DirectoryIterator Class in PHP".

Are you interested in having at your disposal a quick reference for working with the "DirectoryIterator" class that comes with PHP 5? Then this might be the article that you've been waiting for! Welcome to the second tutorial of the series "A Close Look at the DirectoryIterator Class in PHP 5." Over the course of this set of installments, you'll find complete coverage of the most important methods bundled with this class, and learn how to take advantage of their excellent functionality.

They cover even more functions in this part:

  • rewind, current, valid
  • getFileName, isFile
  • getMTime, getATime, getCTime
  • getPath, getPathName
Each set is supported by code and explaination to help introduce their concepts in a useful way.

0 comments voice your opinion now!
tutorial directoryiterator methods part2 path timestamp file tutorial directoryiterator methods part2 path timestamp file


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


DevShed:
Implementing Additional Methods with mysqli and PHP 5
July 10, 2006 @ 07:22:54

DevShed has posted part three of their popular "using mysqli in PHP5" series today, this time, they focus on increasing the functionality of the code they started last time with other mysqli methods.

I must say that the "mysqli" extension offers an impressive set of features, which can be implemented right from the very beginning. However, and speaking of its cool features, in the next few lines, I'm going to show you a few more. Over the course of this last tutorial, I'll be covering some other methods and properties, mainly aimed at finding the IDs after inserting new rows, and obtaining information about specific table fields.

They touch on the fetch_array, data_seek, fetch_assoc, fetch_field, and fetch_seek functions, giving examples and other assicated properties along the way.

0 comments voice your opinion now!
mysqli mysql additional methods php5 tutorial mysqli mysql additional methods php5 tutorial


Ben Ramsey's Blog:
Add Children with SimpleXML
May 11, 2006 @ 20:03:57

In this new post on Ben Ramsey's blog today, he shares his experiences with SimpleXML, mentioning specifically some of the undocumented functions that he's noticed.

I was very excited today while glancing through the code in ext/simplexml/simplexml.c to find some, as of yet, undocumented methods in PHP's SimpleXMLElement class. This discovery came after I've spent several hours over the last couple of nights banging my head against the desk to figure out a way to create a class that extends SimpleXMLElement and adds a new method for adding a child, which would have to use DOM in order to work-or so I thought.

Of course, it's wasn't as easy as it seemed, and Ben soon found some of the limitations of the SimpleXML library. Of course, he did manage to find a way to add new children to the document you're working with (something that normally would have required the intervention of the DOM functionality). Check out the post for a code example.

2 comments voice your opinion now!
php simplexml add children undocumented feature methods dom xml php simplexml add children undocumented feature methods dom xml


Mike Naberezny's Blog:
pecl/operator and Other Neat Stuff
February 02, 2006 @ 06:42:59

Mike Naberezny has this new post on his blog today about the latest extension submitted by Sara Golemon to the PECL library - the pecl/operator extension.

This extension adds operator overloading support to PHP 5. I don't think operator overloading fits the "PHP spirit" and as such I speculate it probably won't ever make it into the core. Regardless, it's interesting that this extension is now available and certainly makes for some fun experiments, especially if you're already familiar with techniques from languages like C++.

He gives some sample code, and mentions the "magic methods" the extension allows. Later in the post, he also looks at a related package (also by Sara) that allows for self-modifying code in PHP - pecl/runkit.

0 comments voice your opinion now!
php pecl/operator magic methods operator overloading php pecl/operator magic methods operator overloading



Community Events











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


PEAR ajax PHP5 mysql code cakephp database example package zend conference developer job zendframework release book security framework releases application

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