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

Tomas Votruba:
14 Tips to Write PHP Code that is Hard to Maintain and Upgrade
Nov 28, 2018 @ 15:17:38

In a new post to his site Tomas Votruba takes the opposite approach to writing good code by sharing bad examples in the form of fourteen tips to write bad code, practices that can make code hard to upgrade and difficult to maintain.

Today I'll show you how to own your company. All you need to do is write code that no-one can read, is hard to refactor and creates technical debt. It's not easy, because if other programmers spot you're writing legacy code, you're busted.

If you keep a low profile of very smart architect and do it right, you'll be the only one in the company who knows what is going on and you'll have a value of gold. Learn how to be successful living vendor lock!

He then goes through his list of poor practices to avoid including:

  • Use protected instead of private
  • Use Non-String Method Names
  • Don't Always use PSR-4
  • Hide Your Dependencies in Constructor
  • Use Annotations to Define Magic Methods
  • Use Traits with Annotations to Define Magic Methods
  • Use as Short Naming as Possible

...and many more. For each item in the list sample code is provided so you'll know exactly what to avoid.

tagged: practices to avoid top14 list development tutorial

Link: https://www.tomasvotruba.cz/blog/2018/11/26/14-tips-to-write-php-code-that-is-hard-to-maintain-and-upgrade/

PHP Magazine:
What Would You Like to See In PHP 6?
Mar 13, 2006 @ 13:41:50

PHP Magazine has posted their results from a poll they took after the "PHP Developers Meeting" that happened in Paris about what developers would like to see in PHP6.

Following release of the PHP Developers Meeting in Paris (November 11th and 12th, 2005), the International PHP Magazine polled the community to find out What they were looking our for, the most, in PHP 6?

The results of the poll suggest almost an equal weightage to all of the points noted in the developer meeting minutes. Of the 809 members polled, 15-20% of the respondents were looking out for OO functionality changes, functionality cleanup, performance boost, Security enhancements, and unicode support, in that order. Only 7% were keen to see additions made to the PHP engine. Less than 3% clicked on the "others" option.

The votes were pretty close, with "Functionality" only barely edging out "Performance Boost". "OO Functionality Changes", however, topped the list with points to spare.

tagged: like to see in php6 poll results OO functionality changes like to see in php6 poll results OO functionality changes

Link:

PHP Magazine:
What Would You Like to See In PHP 6?
Mar 13, 2006 @ 13:41:50

PHP Magazine has posted their results from a poll they took after the "PHP Developers Meeting" that happened in Paris about what developers would like to see in PHP6.

Following release of the PHP Developers Meeting in Paris (November 11th and 12th, 2005), the International PHP Magazine polled the community to find out What they were looking our for, the most, in PHP 6?

The results of the poll suggest almost an equal weightage to all of the points noted in the developer meeting minutes. Of the 809 members polled, 15-20% of the respondents were looking out for OO functionality changes, functionality cleanup, performance boost, Security enhancements, and unicode support, in that order. Only 7% were keen to see additions made to the PHP engine. Less than 3% clicked on the "others" option.

The votes were pretty close, with "Functionality" only barely edging out "Performance Boost". "OO Functionality Changes", however, topped the list with points to spare.

tagged: like to see in php6 poll results OO functionality changes like to see in php6 poll results OO functionality changes

Link:

Michael Kimsal's Blog:
Bizarre PHP behaviour
Feb 16, 2006 @ 20:40:59

In a new post on his blog today, Michael Kimsal looks at an abnormality that he's disocvered with constants in PHP.

Chalk this up as par for the course in the world of PHP, but it doesn't behave as documented. I noticed today that @ work someone is creating database connections, then define()ing the result into a constant. I presumed this was failing silently and because we were generally connecting to only one database (or so I thought initially) that it was simply using the last open connection and still working.

This does *not* throw an error, but does in fact work. Even going back to PHP 4.3.2 (earliest I've checked). This flies in the face of my understanding of constants for years - well, since 1998 (perhaps earlier) or so.

the issue - that a resource can be assigned to a constant - seems to contradict what's listed in the manual, and he asks later if there are others out there that have seen this same issue...

tagged: bizarre behavior assign resource to constant bizarre behavior assign resource to constant

Link:

Michael Kimsal's Blog:
Bizarre PHP behaviour
Feb 16, 2006 @ 20:40:59

In a new post on his blog today, Michael Kimsal looks at an abnormality that he's disocvered with constants in PHP.

Chalk this up as par for the course in the world of PHP, but it doesn't behave as documented. I noticed today that @ work someone is creating database connections, then define()ing the result into a constant. I presumed this was failing silently and because we were generally connecting to only one database (or so I thought initially) that it was simply using the last open connection and still working.

This does *not* throw an error, but does in fact work. Even going back to PHP 4.3.2 (earliest I've checked). This flies in the face of my understanding of constants for years - well, since 1998 (perhaps earlier) or so.

the issue - that a resource can be assigned to a constant - seems to contradict what's listed in the manual, and he asks later if there are others out there that have seen this same issue...

tagged: bizarre behavior assign resource to constant bizarre behavior assign resource to constant

Link:

PHPit.net:
An introduction to XML-RPC in PHP
Jan 30, 2006 @ 13:59:55

PHPit.net has posted this new tutorial, an introduction to XML-RPC in PHP.

n this tutorial I will show you how to create your own XML-RPC web service, allowing other people to connect to your website. I will also show you how to create your own XML-RPC client, which means you can query other web services.

Although PHP comes with inbuilt XML-RPC functionality, we won't be using it in this tutorial, and instead we'll opt for the excellent XML-RPC Library by Simon Willison, available at http://scripts.incutio.com/xmlrpc/. This library includes both the ability to create a XML-RPC server and client, which is exactly what we need.

They start with the server, making a few simple functions to respond to a single request. They even include a bit more advanced code to allow the server to be "self-desciribing". Next comes to client - a simple, single call first, then on to making multiple calls. Included also are demos showing how they will look when working...

tagged: introduction to xml-rpc server client self-describing introduction to xml-rpc server client self-describing

Link:

PHPit.net:
An introduction to XML-RPC in PHP
Jan 30, 2006 @ 13:59:55

PHPit.net has posted this new tutorial, an introduction to XML-RPC in PHP.

n this tutorial I will show you how to create your own XML-RPC web service, allowing other people to connect to your website. I will also show you how to create your own XML-RPC client, which means you can query other web services.

Although PHP comes with inbuilt XML-RPC functionality, we won't be using it in this tutorial, and instead we'll opt for the excellent XML-RPC Library by Simon Willison, available at http://scripts.incutio.com/xmlrpc/. This library includes both the ability to create a XML-RPC server and client, which is exactly what we need.

They start with the server, making a few simple functions to respond to a single request. They even include a bit more advanced code to allow the server to be "self-desciribing". Next comes to client - a simple, single call first, then on to making multiple calls. Included also are demos showing how they will look when working...

tagged: introduction to xml-rpc server client self-describing introduction to xml-rpc server client self-describing

Link:

Utah PHP Users Group:
PHP and JSON
Jan 25, 2006 @ 12:30:14

According to this post on the Utah PHP User Group's website today, there's been talk of adding JSON support to the Core portion of the PHP distributions.

There has been some recent activity on the PHP Developer mailing list about the addition of JSON into the PHP Core. After reading the thread, I did a little research on JavaScript Object Notation (JSON). Here is a great website to read more about it.

You can check out the discussion over on the archived copy of the php-dev mailing list...

tagged: json add to core javascript object notation json add to core javascript object notation

Link:

Utah PHP Users Group:
PHP and JSON
Jan 25, 2006 @ 12:30:14

According to this post on the Utah PHP User Group's website today, there's been talk of adding JSON support to the Core portion of the PHP distributions.

There has been some recent activity on the PHP Developer mailing list about the addition of JSON into the PHP Core. After reading the thread, I did a little research on JavaScript Object Notation (JSON). Here is a great website to read more about it.

You can check out the discussion over on the archived copy of the php-dev mailing list...

tagged: json add to core javascript object notation json add to core javascript object notation

Link:

WebReference.com:
How to Interact with Web Forms (Part 2)
Jan 24, 2006 @ 13:03:09

With a continuation of their previous article, WebReference has posted part two of their "How to Interact with Web Forms" series - an excerpt from the PHP Phrasebook (Sams).

They build on the previous code, showing how to:

  • preselect items from a multiple select list,
  • process image submit buttons
  • checking the mandatory fields
  • checking the values of select lists
They wrap it all up with two handy concepts - how to write out your data to a form and send it off in email form to the location of your choosing and working with the files uploaded via a form.
tagged: how to interact web forms select check require write file email how to interact web forms select check require write file email

Link:


Trending Topics: