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

Laravel Daily:
Three new features in Laravel 5.2.22
Mar 01, 2016 @ 11:17:53

The Laravel Daily site has a quick post on the heels of the latest minor release of the Laravel framework, v5.2.2, that includes some of the new features that came along with it.

Two days ago Taylor Otwell released a new minor version of Laravel framework – 5.2.22. Along with some small fixes, there are a few new functions, let’s look into them.

The three features they talk about aren't major changes to the framework but they are helpful to those needing these little tweaks:

  • Validate array distinct (a new rule to validate if array has only different values)
  • fullUrlWithQuery (automatically adding query parameters to a url() kind of call)
  • Blade: continue and break (more flow control in Blade templates)

Examples are included showing how to use the new functionality as well.

tagged: laravel feature release array distinct fullurlwithquery blade continue break

Link: http://laraveldaily.com/three-new-functions-in-laravel-5-2-22/

Acquia Blog:
A Look at PHP's Continuing Evolution
Aug 26, 2013 @ 15:13:46

On the Acquia blog there's a new post looking at the evolution of the PHP language and some of the newer features included in recent releases.

PHP is not a young language. As of 2013, it's 18 years old; that's old enough to vote. Many upstart languages have appeared over the years to try and unseat PHP as the "lingua franca" of web applications but it still commands over 80% of the web market. One reason for PHP's popularity is no doubt the ease with which new developers can get started with it, but just as important is the fact that PHP has been evolving for all those 18 years.

He covers things added over the last several major revisions of the language (with code examples) - things like anonymous functions, traits and generators.

tagged: language continue evolution acquia larrygarfield

Link: https://www.acquia.com/blog/look-phps-continuing-evolution

PHPMaster.com:
Learning Loops
Dec 15, 2011 @ 10:15:00

PHPmaster.com has a new introductory tutorial for those just starting out with PHP (or with programming really) talking about using looping structures for sets of data - for, while/do-while and foreach.

A significant advantage of computers is that they can perform repetitive tasks easily and efficiently. Instead of writing repetitive code you can write a set of statements that processes some data and then have the computer execute them repeatedly by using a construct known as a loop. Loops come in several different flavors in PHP: for, while, do-while, and foreach. I'll introduce you to each of them and show you how they can making repetitive tasks straightforward and easy to maintain.

The tutorial explains a use case for each of the loop types and includes a bit of sample code showing how to put it into practice. It also shares two special keywords that can be used to bypass or break out of your current loop - break and continue.

tagged: introduction tutorial loop dataset for while foreach break continue

Link:

Jani Hartikainen's Blog:
Three PHP mistakes that will cause you debugging nightmares
Jan 22, 2009 @ 12:51:50

Jani Hartikainen has posted about three simple, but hard to find, mistakes that can cause you endless frustration if you're not looking in the right places.

Here's his list:

  • Semicolon after a while - a small problem with big (infinitely looping) consequences)
  • empty() and magic __get method - __get will hit first, then empty
  • Missing semicolon after break or continue - a classic that can make switches and evaluations difficult to debug

Comments on the post include a few others: working with variables by reference, comparisons with == versus === and strpos finding the first character in a string.

tagged: mistake semicolon empty magic break continue debug nightmare

Link: