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

Ian Barber's Blog:
Benford's Law
Apr 05, 2011 @ 14:12:46

In a recent post to his blog Ian Barber looks at applying Benford's Law in PHP to determine if the dataset you're working with is "real" or not.

Benfords Law is not an exciting new John Nettles based detective show, but an interesting observation about the distribution of the first digit in sets of numbers originating from various processes. It says, roughly, that in a big collection of data you should expect to see a number starting with 1 about 30% of the time, but starting with 9 only about 5% of the time.

He pulls data from the data.uk.gov site to illustrate and includes a simple PHP script to run through the data looking scoring it with a "Benford" rating. He plots these on a graph along side the data to show the (almost exact) match between the data and the Benford numbers. You can find more details on the law on Wikipedia.

tagged: benfordslaw real fake data evaluate

Link:

Dagfinn Reiersol's Blog:
Real programming with PHP 5.3 (part 3): Links
Apr 13, 2009 @ 12:58:41

On his blog today Dagfinn Reiersol has posted the next part of his "real programming with PHP 5.3" series looking at links.

After the previous post in this series, additional independent implementations of the idea of JavaScript-style classes have turned up. So I’m going to list them and comment briefly on the differences. I hope this will be helpful to anyone who actually wants to use this in practice and needs to decide on the details of the implementation.

The previous article looked at Javascript-style classes that can be build with the new closures/lambda function support that PHP 5.3 will include. A few of the other examples of this method he mentions include this look from Ionut Stan's forum post and Andrea Giammarchi's blog post on making a Javascript object-like class.

tagged: php5 real programming series javascript object class closure lambda

Link:

PHP in Action:
Real programming with PHP 5.3 (part 1): array processing
Mar 19, 2009 @ 16:18:20

On the PHP in Action blog, a new series has been kicked off with this first part looking at "real programming" in the upcoming PHP 5.3 release.

You may have heard of the new features that are scheduled for PHP 5.3, but who knows what they can be used for in real programming? I took the time for some experimental research, and came up with a few examples.

This first part focuses on the new lambda/closures functionality that will come with the new release. He compares it to the create_function syntax currently offered, specifically when it comes to sorting and manipulating arrays.

tagged: php5 lambda closure array processing tutorial real

Link:

Community News:
No Starch Press Releases "Wicked Cool PHP"
Feb 13, 2008 @ 22:07:00

No Starch Press has officially released their PHP title "Wicked Cool PHP" (Real-World Scripts That Solve Difficult Problems).

Here's a bit from the press release:

Wicked Cool PHP [...] is a different breed of PHP book. It's made specifically for the developer who wants to know how to get things done without mucking around and wasting a lot of time. This is not a weighty PHP complete reference or bible that threatens to take down your bookshelf and the rest of the bookcase. This is a book for coders to pick up and use, not wade through.

It provides the reader with "76 immediately useful PHP scripts" that do a variety of things like send/receive email notifications, do some web scraping, track users with cookies and sessions and use web services like SOAP.

You can find out more about the book on this page on the O'Reilly website. The book will officially hit the stands February 15th.

tagged: nostarchpress oreilly real script book release wicked

Link:

Jacob Santos' Blog:
Multitasking in PHP
Aug 19, 2006 @ 20:23:43

In his latest blog post, Jacob Santos takes a look at a common request PHP developers hit after a while - is it possible to multitask processes/actions in php?

The ability to run two or more commands in parallel is totally sexy, but the Web is a different playing field and it doesn’t make complete sense.

PHP loses control, once the output is sent and the connection is closed. Multithreading would probably make sense in streaming, but PHP already handles that for you where it makes sense for the function. Furthermore, mulithreading has its purpose in applications that continue to run and not something that closes and cleans up everything after the last command is issued.

He continues talking more about what multitasking is, a more real life example, the goods, the bads, and some of the issues that can come along with it. Finally, he suggests a feature to be added to the core of PHP - an "internal multitasking mechanism" to help aid these kinds of processes.

tagged: multitasking common questions real world good bad multitasking common questions real world good bad

Link:

Jacob Santos' Blog:
Multitasking in PHP
Aug 19, 2006 @ 20:23:43

In his latest blog post, Jacob Santos takes a look at a common request PHP developers hit after a while - is it possible to multitask processes/actions in php?

The ability to run two or more commands in parallel is totally sexy, but the Web is a different playing field and it doesn’t make complete sense.

PHP loses control, once the output is sent and the connection is closed. Multithreading would probably make sense in streaming, but PHP already handles that for you where it makes sense for the function. Furthermore, mulithreading has its purpose in applications that continue to run and not something that closes and cleans up everything after the last command is issued.

He continues talking more about what multitasking is, a more real life example, the goods, the bads, and some of the issues that can come along with it. Finally, he suggests a feature to be added to the core of PHP - an "internal multitasking mechanism" to help aid these kinds of processes.

tagged: multitasking common questions real world good bad multitasking common questions real world good bad

Link:

The PHP Grind:
Get real about PHP4 vs. PHP5!
Jun 08, 2006 @ 19:48:46

From ThePHPGrind.net today, there's a new post with some opinions on the real differences between PHP4 and PHP5, including suggetions to just make the jump to the latest version.

I am repeated aggravated by so called “reputable” people in the PHP industry marginalizing and downplaying PHP5 in favor of the ever aging and antiquated PHP4.

And, I'm not talking about small applications. I'm talking about a complete online fantasy sports systems. Content and product management, e-commerce, integration systems and many custom modules for very large companies in the construction and industrial manufacturing industries. Company names that your kids probably know, but names that probably shouldn’t be mentioned in my little rant here out of respect.

He makes the case that not only is it a pretty simple matter to make the move (usually) plus the fact that several large companies using PHP have already made the leap as well. I also like this great little "soundbite" quote he shares:

PHP5 is here already, and many of its' versions are completely stable for the vast majority of people. And, soon PHP6 will be here whether other people like it or not. So, why not get ready?
tagged: get real php4 php5 versus upgrade large get real php4 php5 versus upgrade large

Link:

The PHP Grind:
Get real about PHP4 vs. PHP5!
Jun 08, 2006 @ 19:48:46

From ThePHPGrind.net today, there's a new post with some opinions on the real differences between PHP4 and PHP5, including suggetions to just make the jump to the latest version.

I am repeated aggravated by so called “reputable” people in the PHP industry marginalizing and downplaying PHP5 in favor of the ever aging and antiquated PHP4.

And, I'm not talking about small applications. I'm talking about a complete online fantasy sports systems. Content and product management, e-commerce, integration systems and many custom modules for very large companies in the construction and industrial manufacturing industries. Company names that your kids probably know, but names that probably shouldn’t be mentioned in my little rant here out of respect.

He makes the case that not only is it a pretty simple matter to make the move (usually) plus the fact that several large companies using PHP have already made the leap as well. I also like this great little "soundbite" quote he shares:

PHP5 is here already, and many of its' versions are completely stable for the vast majority of people. And, soon PHP6 will be here whether other people like it or not. So, why not get ready?
tagged: get real php4 php5 versus upgrade large get real php4 php5 versus upgrade large

Link:

Sitening.com:
Getting Real With Databases in PHP
Jun 01, 2006 @ 11:11:58

This new post on the Sitening.com blog (written up by Tyler Hall) today takes a look at PHP and databases (MySQL specifically in this case) and "getting real" with them.

many of the ideas behind Ruby on Rails are spot on. I particularly like how well it abstracts database queries into separate objects for each table. That’s very cool and can save having to write a lot of repetitive code. But having to run a Rails script to generate new files is a little too cumbersome for me. Like I said, I prefer to keep things simple. Can we do the same thing with PHP? Using just one file?

Yes.

He proceeds to show a class that can perform operations similar to those styled in RoR - creating the object, applying proterties to it and performing the action (inserts/delete/etc). It's all made possible through the use of the __get and __set functions offered in PHP5. From there, it's just a simple matter of defining the functions for the actions.

To bring the point home, he also includes some examples of how to use this kind of functionality with a bit more than the previous example - selecting, updating, deleting, and inserting a new record (including the action function for each). Lastly, he gives an example of extending this base class, as mentioned in his first example (creating an object like "Animal" or "User" to abstract out the connections even more.

tagged: getting real databases rubyonrails class __get __set getting real databases rubyonrails class __get __set

Link:

Sitening.com:
Getting Real With Databases in PHP
Jun 01, 2006 @ 11:11:58

This new post on the Sitening.com blog (written up by Tyler Hall) today takes a look at PHP and databases (MySQL specifically in this case) and "getting real" with them.

many of the ideas behind Ruby on Rails are spot on. I particularly like how well it abstracts database queries into separate objects for each table. That’s very cool and can save having to write a lot of repetitive code. But having to run a Rails script to generate new files is a little too cumbersome for me. Like I said, I prefer to keep things simple. Can we do the same thing with PHP? Using just one file?

Yes.

He proceeds to show a class that can perform operations similar to those styled in RoR - creating the object, applying proterties to it and performing the action (inserts/delete/etc). It's all made possible through the use of the __get and __set functions offered in PHP5. From there, it's just a simple matter of defining the functions for the actions.

To bring the point home, he also includes some examples of how to use this kind of functionality with a bit more than the previous example - selecting, updating, deleting, and inserting a new record (including the action function for each). Lastly, he gives an example of extending this base class, as mentioned in his first example (creating an object like "Animal" or "User" to abstract out the connections even more.

tagged: getting real databases rubyonrails class __get __set getting real databases rubyonrails class __get __set

Link:


Trending Topics: