News Feed
Sections




News Archive
feed this:

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

Giorgio Sironi:
The full list of my articles on DZone
April 25, 2014 @ 10:13:43

Giorgio Sironi has posted his quite impressive list of articles he's published on the DZone.com site to his blog today. They cover a wide range of topics - everything from refactoring to design patterns out to, well, lots of other random topics.

From 2010 to the end of 2013 I have written a few articles each week on DZone. Here is the full list as a reference.

Some of the posts fall into different "series" categories including "Practical PHP Patterns", "Practical PHP Refactoring", "Practical PHP Testing Patterns" and "Lean Tools". There's some great content here - and lots of it - so be sure to check out the list and see if there's anything that catches your eye!

0 comments voice your opinion now!
article list dzone series reference

Link: http://www.giorgiosironi.com/2014/04/the-full-list-of-my-articles-on-dzone.html

DZone.com:
Cloning in PHP
May 17, 2013 @ 11:09:42

In this recent post over on DZone.com Giorgio Sironi takes a look at the "clone" feature of PHP - what it is, how it can be used and things to watch out for in its use.

Cloning is an operation consisting in the duplication of a data structure, usually to avoid the aliasing problem of having different code modify the same instance in inconsistent ways. In PHP, cloning can be accomplished in multiple ways - and in some cases it can be avoided altogether.

He talks some about how objects are passed around internally during the PHP execution and how you can tell if a function works with data by reference (from the manual). He then looks at the "clone" keyword and what kinds of things are duplicated from an object when it is used. He briefly touches on the "__clone" magic method for solving the "shallow clone" problem and how, possibly, serializing the object might be a better alternative for reproducing the entire object.

0 comments voice your opinion now!
clone introduction object reference serialize shallow deep

Link: http://css.dzone.com/articles/cloning-php

PHPClasses.org:
6 Reasons Why PHP is a Hobbit
February 18, 2013 @ 13:03:26

The PHPClasses.org site has posted a humorous look at the PHP language with several reasons why PHP is a "hobbit" (a Lord of the Rings series reference):

Sometime ago a user of the Quora site asked a question if there was a language war, which languages you support and why. Another user gave a very creative response comparing programming languages with characters of the Lord of the Rings story of JRR Tolkien.

There's six reasons listed in the post:

  • PHP is Scripted C
  • PHP is not Teaming with C++ Evil
  • PHP is Not particularly Beautiful but it is Very Useful
  • PHP is Not the Fastest Language to Execute but is Agile
  • JavaScript could be a Hobbit too but Asynchronous Programming is a Hell
  • PHP Success Causes the Envy of Others

If you're interested to see the thread where the idea for this post came from, you can read it here on Quora.

0 comments voice your opinion now!
language hobbit lordoftherings reference reasons


Lee Davis' Blog:
The enum conundrum
July 06, 2012 @ 11:56:52

In a new post to his blog Lee Davis describes the enum conundrum - what's the right solution for effectively using ENUM-type fields in your data?

So a user signs up and I want to store a status that reflects their account, or at least an identifier representing that status. Their account could be active, disabled (temporarily), pending approval or maybe deleted. Should I use an enum? I've heard they're evil. Maybe having a reference table with statuses would be better? But now I have to manage a separate table just for that one snippet of data, is that overkill? Could I maybe use that status table for other entities? Or, could I instead just use an integer and reference it on the code level? What is the right solution?

He presents three of the most common situations he's seen for people using enums in the application:

  • "I used enums all over the place" (maintenance between code and DB values)
  • "use a reference table"
  • "I could use a class constant to represent the enum" (enforced in the app)

Of the three, he suggests the third as the option with the most advantages. Not only does it make it simpler to get the allowed values for the field, but you're also more flexible in the kinds of validation you can do on the values.

0 comments voice your opinion now!
enum conundrum reference table constant maintenance


CodeDevelopr.com:
50 Web Developer Documentation Manuals You Need To Know About
June 25, 2012 @ 11:55:11

The CodeDevelopr.com site has posted a handy reference list of 50+ guides and manuals that can make looking up those key facts easier.

This is a list of over 50+ Documentation Manuals and Guides for Programmers, Web Developers, and Web Designers. I will actively update this list with more Manuals as I come across them. If you would like something added, please leave it in the comments section below. Over time it will become more refined and better organized and in return, more useful so please bookmark and share with your friends.

Linked resources include:

0 comments voice your opinion now!
documentation developer manual list reference


Mayflower Blog:
Zend Framework Application.ini Cheat Sheet
February 06, 2012 @ 11:42:22

On the Mayflower blog today there's a new post sharing a Zend Framework application.ini "cheat sheet" with links to pages in the ZF manual explaining the details about each of the front controller options.

All this is long gone in the past since the introduction of Zend_Application and the bootstrapping resource adapters. Zend introduced a standard bootstrapping mechanism into their framework. Many of the options from different framework components can now be configured in the applications configuration file application.ini. One problem persists although: the documentation. All the parameters for components like View, Session, Database etc. are documented either with the bootstrap resource, the component itself or both.

They've posted it to github complete with sections detailing:

  • CacheManager
  • Db
  • FrontController
  • Layout
  • Navigation
  • Router
  • Translate

...and quite a few more. This is a great reference for anyone using the Zend Framework, no matter your experience level.

0 comments voice your opinion now!
zendframework applicationini cheatsheet configuration reference


Ryan Gantt's Blog:
Anonymous recursion in PHP
August 11, 2011 @ 10:55:35

In a recent post to his blog Ryan Gantt looks at an interesting way to get around a limitation in PHP dealing with anonymous recursion and closures that throws a Fatal error when called.

Turns out that variables called as functions must be an instance of Closure, an instance of a class which implements __invoke(), or a string representing a named function in the global namespace. In the anonymous function body above, $fibonacci is none of these. It is an undeclared, free variable in the closure created by the anonymous function. At the time when it's called, it hasn't been bound-hence the Notice that you would have gotten if error reporting were set at a high enough threshold - and therefore can't be called as anything, let alone as a function.

He tried using the "use" functionality PHP closures have to bring a variable/object/etc into the scope of the running function, but it still threw an error. As it turns out, the combination of "use"-ing the object and calling it by reference handles things correctly. He takes this method and applies it in two examples - one call in an array_map function and another in an array_reduce.

0 comments voice your opinion now!
anonymous recursion reference invoke closure


DZone.com:
PHP Quick Reference
April 06, 2011 @ 08:34:05

On DZone.com today there's a new post from Chris Shiflett sharing some timeless advice from an older copy of a PHP Quick Reference (published in 2009) about performance and security.

While cleaning out my desk, I found an old copy of a PHP Quick Reference I helped make a few years ago. On the front page are a few performance and security tips that I thought I'd share. (Performance tips are from George Schlossnagle.)

Performance tips include profile early/profile often, cache when possible and don't over-optimize. The security hints include some of the usual suspects - trust nothing, filter input/escape output and use prepared statements.

0 comments voice your opinion now!
quick reference advice security performance


Giorgio Sironi's Blog:
The PHPUnit Refcard is out
November 15, 2010 @ 11:58:17

Unit testing fans will be happy to know that a Refcard from DZone has been published (authored by Giorgio Sironi) so you can keep PHPUnit at your fingertips.

Do you occasionally forget the syntax for creating Mocks and Stubs in PHPUnit? Or wonder how a command line option work? Or if there is an assertion that may be perfect for the test you're writing? Then this Refcard can help you. The Refcard is a PDF cheatsheet of 6 pages, which interleaves code samples with explaining test and sample outputs. Getting to know PHPUnit to use it at its full potential will be a little easier now.

You can check out the contents of the refcard on the DZone site or download a PDF to make it all your own.

0 comments voice your opinion now!
reference card dzone phpunit release


Derick Rethans' Blog:
Collecting Garbage PHP's take on variables
August 31, 2010 @ 10:49:11

Derick Rethans is republishing an article series he wrote (originally for php|architect) about the garbage collection that is included with the PHP 5.3 releases. He kicks off the series with this first post introducing internal variable handling.

Before we start with the intricate details of PHP's new GC engine I will explain why it is actually needed. This, combined with an introduction how PHP deals with variables in general is explained in this first part of the column. The second part will cover the solution and some notes on the GC mechanism itself, and the third part covers some implications of the GC mechanism, as well as some benchmarks. But now first on to the introduction.

He introduces the concept of a "zval" - the container PHP uses internally to handle variables (along with its "is_ref" and "refcount" to tell the interpreter if it's a reference or not). He also shows how these relate to the variables you set in your applications as well as a mention of the xdebug_debug_zval function of XDebug to show how it's handled behind the scenes. He also shows how references are handled with accompanying images to show the flow. If you'd like more information on variable handling, Derick points to this article for more detail.

0 comments voice your opinion now!
garbage collection variable introduction zval reference xdebug



Community Events





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


podcast install series release deployment list introduction laravel community framework opinion library symfony interview api language zendserver package update tips

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