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

Ez.no Blog:
Why PHP and Symfony, and Not Java
Oct 12, 2016 @ 11:17:05

On the Ez.no blog there's an interesting post comparing PHP and Symfony to Java and some of their own reasoning behind the choice of one over the other.

We are often asked, especially from our enterprise customers at financial institutions, why we decided to go with PHP and Symfony instead of a Java framework. And as we have actually re-considered alternatives both in 2007 and 2011, we know the answer pretty well. We also know firsthand how much PHP and the PHP ecosystem has matured and progressed the last few years, how Symfony2 and Composer provided a big jump forward, how PHP v7 and Symfony3 is positioned to provide the next, in the end making us very confident in our choice and in recommending it to others.

They then talk about some of the arguments of PHP versus Java, some that are pretty familiar to those in the PHP camp:

  • PHP is "just a scripting language"
  • Java is more scalable
  • PHP's performance is bad in comparison
  • Poor tools support for PHP

For each of these they link to more information and describe the current state of PHP and its ecosystem to help refute the claim. They then get into the Symfony portion, comparing it to similar Java frameworks, listing advantages like the large pool of Symfony developers and its vibrant community.

tagged: java language choice symfony framework misconception argument

Link: https://ez.no/Blog/Why-PHP-and-Symfony-and-not-Java

Lorna Mitchell:
PHP 5.6 and the Splat Operator
Mar 17, 2014 @ 09:05:36

Lorna Mitchell has a new post to her site looking at a feature of the upcoming PHP 5.6 release, the splat operator (three ellipsis...).

We have a couple of new features coming in to PHP 5.6 with names that sound much less exciting than the features they actually represent: "variadic functions" sound positively academic, and "argument unpacking" isn't exactly catchy. However they both use a new operator in PHP which looks like an elipsis (three dots ...) and is referred to as either the splat operator or the scatter operator. I included them in a recent version of my "Upgrading PHP" talk so I thought I'd share the examples here too in case anyone is interested.

She includes an example of it being used in a variadic function, one that lets you define an optional number of parameters without having to resort to func_get_args. She also talks about "argument unpacking" or the passing in of an array of values with the splat to have it handled like a string. An example with the mail function is included.

tagged: php56 splat operator variadic function argument unpacking

Link: http://www.lornajane.net/posts/2014/php-5-6-and-the-splat-operator

CodeUtopia.net:
Is PHP a good first language?
May 01, 2008 @ 13:39:53

The CodeUtopia blog asks the online community for their opinion - what do you think of PHP as a first language?

Sometimes I've seen people say PHP is a bad first language, because it teaches bad programming habits. But is this actually true at all? Often those who say that don't really like PHP themselves either, many times because of equally untrue reasons.

They argue both sides of the situation, mentioning what could make for a good first language, why PHP is a "nearly perfect" fit for it and some arguing points for the other side as to why PHP isn't the best option.

tagged: good first programming language argument pro con

Link:

Rails for PHP Developers:
Three New Articles Posted (Scope, Variables & RegEx)
Feb 19, 2008 @ 08:44:00

Mike Naberezny has posted a few more articles to the "Rails for PHP Developers" website (based on this book) covering some more of the basics.

There's three new tutorials posted:

  • Ruby Block Scope - the basics of Ruby block scope, a common point of confusion for PHP developers new to Ruby.
  • Variable Arguments - an article that shows two common API patterns found in Rails, variable arguments and option hashes, and how to implement them both in PHP.
  • Regular Expressions in Ruby - a useful reference that maps all of the common PHP regular expression functions to the equivalents in Ruby.

Check out the rest of the site for even more great content.

tagged: rails development regularexpression variable argument scope ruby

Link:

Jeff Moore's Blog:
Improved Error Messages in PHP
Oct 08, 2007 @ 10:29:00

Jeff Moore mentions a "sweet improvement" he noticed when comparing the error message from a PHP4 script to a PHP5 one - the location reported for error mesages.

Sometimes its the little things that make a difference.

His sample script (a function call without the argument needed) errors on the location of the function definition in PHP4, but happily PHP5 recognized the problem for what it's worth and echoed out the location of the call to that function instead for the line number.

One more reason to ditch PHP 4 and go php 5.
tagged: improve error message php4 php5 argument call improve error message php4 php5 argument call

Link:

Jeff Moore's Blog:
Improved Error Messages in PHP
Oct 08, 2007 @ 10:29:00

Jeff Moore mentions a "sweet improvement" he noticed when comparing the error message from a PHP4 script to a PHP5 one - the location reported for error mesages.

Sometimes its the little things that make a difference.

His sample script (a function call without the argument needed) errors on the location of the function definition in PHP4, but happily PHP5 recognized the problem for what it's worth and echoed out the location of the call to that function instead for the line number.

One more reason to ditch PHP 4 and go php 5.
tagged: improve error message php4 php5 argument call improve error message php4 php5 argument call

Link:

Stefan Mischook's Blog:
PHP Video Tutorial: Functions
Oct 04, 2007 @ 08:43:00

Stefan Mischook has posted the latest video tutorials in his introduction to PHP series today - this time they look at the creation of and working with functions in your applications.

I just released the first 3 videos on PHP functions that covers some of the basics on this fundamental construct in PHP. In these videos I cover things like: what exactly are functions, what are a functions 'arguments' and why do functions 'return' things.

There's three videos in this set - part 1, part 2 and part 3. If you're new to PHP and want to get a good, solid base in functions and what they're for, be sure to check these videos out.

tagged: video tutorial introduction language function argument return video tutorial introduction language function argument return

Link:

Stefan Mischook's Blog:
PHP Video Tutorial: Functions
Oct 04, 2007 @ 08:43:00

Stefan Mischook has posted the latest video tutorials in his introduction to PHP series today - this time they look at the creation of and working with functions in your applications.

I just released the first 3 videos on PHP functions that covers some of the basics on this fundamental construct in PHP. In these videos I cover things like: what exactly are functions, what are a functions 'arguments' and why do functions 'return' things.

There's three videos in this set - part 1, part 2 and part 3. If you're new to PHP and want to get a good, solid base in functions and what they're for, be sure to check these videos out.

tagged: video tutorial introduction language function argument return video tutorial introduction language function argument return

Link:

PHPit.net:
Using globals in PHP
Jun 27, 2006 @ 14:53:34

In this new tutorial from PHPit.net today, Dennis Pallett talks about using globals in PHP, desscribing what they are and how to use them.

Whenever you're developing a new large-scale PHP script, you're bound to use global variables, since some data needs to be used by multiple parts of your script. Good examples of global data are script settings, database connections, user credentials and more. There are many ways of making this data global, but the most commonly used way is to use the global keyword, which we will explore later on in this article.

It's good that he mentions right from the start that most global data is a bad idea, and can really start to clutter up an application. He does help the reader prevent this, though, through the use of a few handy techniques (and design patterns).

He looks first at the "global" keyword and its use, followed by three reasons that it's not all that favorable to use. He gives other options for the "just make it global" thinking, including passing the values in function calls, passing by reference, and using the Singleton and Registry patterns to contain things a bit more. He even includes a wrapper for the registry to handle the only other globals left - the superglobals - with the same registry functionality.

tagged: globals using tutorial singleton registry reference argument globals using tutorial singleton registry reference argument

Link:

PHPit.net:
Using globals in PHP
Jun 27, 2006 @ 14:53:34

In this new tutorial from PHPit.net today, Dennis Pallett talks about using globals in PHP, desscribing what they are and how to use them.

Whenever you're developing a new large-scale PHP script, you're bound to use global variables, since some data needs to be used by multiple parts of your script. Good examples of global data are script settings, database connections, user credentials and more. There are many ways of making this data global, but the most commonly used way is to use the global keyword, which we will explore later on in this article.

It's good that he mentions right from the start that most global data is a bad idea, and can really start to clutter up an application. He does help the reader prevent this, though, through the use of a few handy techniques (and design patterns).

He looks first at the "global" keyword and its use, followed by three reasons that it's not all that favorable to use. He gives other options for the "just make it global" thinking, including passing the values in function calls, passing by reference, and using the Singleton and Registry patterns to contain things a bit more. He even includes a wrapper for the registry to handle the only other globals left - the superglobals - with the same registry functionality.

tagged: globals using tutorial singleton registry reference argument globals using tutorial singleton registry reference argument

Link: