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

SitePoint PHP Blog:
MySQL Transactions & Why They Can’t Be Emulated in PHP
Dec 15, 2010 @ 18:47:44

On the SitePoint blog there's a new article from Craig Buckler stating that MySQL transactions can't be emulated in PHP and shouldn't be discounted despite many developers seeing them as not much more than a performance hit.

My recent article, "Top 10 MySQL Mistakes Made by PHP Developers" was far more controversial than I expected. Several of the more intriguing responses were from PHP coders who considered transactions to be an unnecessary overhead. With good-quality PHP code, they argued, you don’t need transactions or MySQL's InnoDB storage engine. It's certainly true you don’t always need transactions.

He gives an example of a situation where database-based transactions would be very useful (inserting customer information) and points out that, despite the best intentions of developers, reducing as many layers and connections between SQL and code is a good thing. Transactions help you conform to the ACID ideas and keep data integrity by only having things in the database that were successful. He includes a small bit on using transactions as well.

tagged: mysql transaction emulate opinion acid integrity mysql

Link:

NETTUTS.com:
Twitter Emulation Using MooTools 1.2 and PHP
Nov 11, 2008 @ 20:18:35

NETTUTS.com has a new tutorial posted today showing how to combine some simple PHP scripts with the MooTools Javascript library to emulate the popular social site Twitter.

People all over the world love Twitter because of how easy it is to use. All you need to do is type in your current status, click "Update", and you're done. What most people probably don't know is how simple it is to emulate Twitter's functionality. Using PHP, MySQL, and MooTools javascript, you can implement a Twitter-like status system in no time.

Their mini-application (download the source here) creates a basic input box and a list of messages below. The MooTools library is used to send the message back to the PHP script and update the messages list with the latest from the current user. Complete code and screenshots of examples are included.

tagged: mootools tutorial twitter emulate source javascript library

Link:

DevShed:
Executing Destructors Manually in PHP 5
Feb 13, 2008 @ 17:27:00

Finishing off their series on destructors in PHP5 applications today, DevShed has posted this new tutorial showing how to manually run the destructors of your class (in case there's ever a need).

In this final tutorial of the series I'm going to show you how to manually trigger a destructor, and in addition you'll learn how to emulate the behavior of this magic method when using PHP 4.

They not only talk about how to call the destructor manually but they also show how to call multiple destructors at the same time to destroy lots of objects at once. And, as promised, they include a method for being able to use a destructor-like bit of functionality in a PHP4 app as well.

tagged: php5 destructor execute manual php4 emulate multiple

Link:

Ozh's Blog:
PHP and GD - Emulate Gradient Fill
Feb 14, 2006 @ 12:54:19

On Ozh's site, FrenchFragFactory.net, today, there's this handy little post dealing with the creation of gradients in PHP with the help of GD.

Here is a small PHP function I wrote that emulates a gradient fill of an image.

Disclaimer : there are probably existing alternatives or classes, maybe in PEAR. I didn't check. I wanted to write a function myself, as part of my GD training grounds.

The script is simple enough, and only uses four different variable values to make the patterns. There are a few examples of the end result in the form of a basic square output, but (as he mentions) it can be used just as easily in other situations. The source code is availible in either plain-text or in a .phps style file.

tagged: gd graphics library emulate gradient fill gd graphics library emulate gradient fill

Link:

Ozh's Blog:
PHP and GD - Emulate Gradient Fill
Feb 14, 2006 @ 12:54:19

On Ozh's site, FrenchFragFactory.net, today, there's this handy little post dealing with the creation of gradients in PHP with the help of GD.

Here is a small PHP function I wrote that emulates a gradient fill of an image.

Disclaimer : there are probably existing alternatives or classes, maybe in PEAR. I didn't check. I wanted to write a function myself, as part of my GD training grounds.

The script is simple enough, and only uses four different variable values to make the patterns. There are a few examples of the end result in the form of a basic square output, but (as he mentions) it can be used just as easily in other situations. The source code is availible in either plain-text or in a .phps style file.

tagged: gd graphics library emulate gradient fill gd graphics library emulate gradient fill

Link:


Trending Topics: