background preloader


Facebook Twitter


Doctrine. Zend. Five common PHP design patterns. Editor's note: See the follow-up article "Five more PHP design patterns" to learn about five additional design patterns that you might find useful.

Five common PHP design patterns

Design patterns were introduced to the software community in Design Patterns, by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (colloquially known as the "gang of four"). The core concept behind design patterns, presented in the introduction, was simple. Over their years of developing software, Gamma et al found certain patterns of solid design emerging, just as architects designing houses and buildings can develop templates for where a bathroom should be located or how a kitchen should be configured.

Having those templates, or design patterns, means they can design better buildings more quickly. The same applies to software. Design patterns not only present useful ways for developing robust software faster but also provide a way of encapsulating large ideas in friendly terms. The factory pattern The problem is tight coupling. Ajax Fancy Captcha - jQuery plugin - Drag and Drop Captcha Demo What is it: Ajax Fancy Captcha is a jQuery plugin that helps you protect your web pages from bots and spammers.

Ajax Fancy Captcha - jQuery plugin -

We are introducing you to a new, intuitive way of completing “verify humanity” tasks. In order to do that you are asked to drag and drop specified item into a circle. Captcha’s security level is medium, with the emphasis on nice looking and user friendly qualities while still offering reasonable protection from unwanted “guests”. Update for September 2009: reduced size,easier integration,easy translate,few common problems fixed. File structure: -captcha –imgs –captcha.css –jquery.captcha.js –captcha.php – -latest-jquery -latest-jquery-ui -example.html -readme.txt.


PHP Tutorials Examples Convert BMP to JPG. Debugging PHP with xDebug inside of Eclipse PDT 2.1. Wrapping C++ Classes in a PHP Extension. One of the most common reasons people write extensions for PHP is to link against an external library and make available its API to PHP userspace scripts.

Wrapping C++ Classes in a PHP Extension

Often the external library is written in C or C++. If you are tasked with writing such an extension that links against an object oriented C++ library, you will probably want to wrap the C++ classes and make them available to PHP userspace scripts. This is pretty easy to do once you get over a few initial hurdles. In this tutorial I am going to walk you through creating a PHP extension called “vehicles” which will expose a single class called “Car” (obviously in the real-world, your extensions will expose many classes, but I’m trying to keep things simple). The extension will be built for PHP 5. File Layout The extension you will be creating consists of several files which you should place in a directory called vehicles: Configuring the PHP Build System I trimmed the output, but you get the idea. The C++ Class. Resizing images with PHP. The following script will easily allow you to resize images using PHP and the GD library.

Resizing images with PHP

If you’re looking to resize uploaded images or easily generate thumbnails give it a try Update: Looking to resize transparent PNG’s and GIF’s? We’ve updated our original code, take a look at Usage Save the code from the ‘the code’ section below as SimpleImage.php and take a look at the following examples of how to use the script. The first example below will load a file named picture.jpg resize it to 250 pixels wide and 400 pixels high and resave it as picture2.jpg If you want to resize to a specifed width but keep the dimensions ratio the same then the script can work out the required height for you, just use the resizeToWidth function. You may wish to scale an image to a specified percentage like the following which will resize the image to 50% of its original width and height You can of course do more than one thing at once.

The code Further Information.


Drupal. Référence des fonctions. The 5th Annual China PHP Conference Affecte le comportement de PHP » « Using SystemTap with PHP DTrace Static Probes Manuel PHP Edit Report a Bug Référence des fonctions ¶ Astuce Voir aussi Catégorie/Liste des extensions. add a note User Contributed Notes There are no user contributed notes for this page.

Référence des fonctions