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

Nikita Popov:
Order of evaluation in PHP
September 25, 2013 @ 10:51:35

If you're the kind of person that wonders more about the internals of PHP and how it works "under the covers" you'll find this new post from Nikita Popov a good read. It talks about how PHP handles its order of operations in more complex evaluation statements.

At this point many people seem to think that the order in which an expression is evaluated is determined by operator precedence and associativity. But that's not true. Precedence and associativity only tell you how the expressions are grouped.[...] What does this tell us about the order of evaluation? Nothing. Operator precedence and associativity specify grouping, but they do not specify in which order the groups are executed.

He gives a few examples to illustrate his point including multiple increments of the same variable at one time and how it's the "fault" of the compiled variables that were introduced in PHP 5.1. He shows the opcode version of the same PHP userland code and talks briefly about how to avoid this odd functionality in your application.

0 comments voice your opinion now!
order evaluation opcode compiled variable

Link: https://gist.github.com/nikic/6699370

Michael Nitschinger:
A Journey on Avoiding Nulls in PHP
February 20, 2013 @ 12:17:39

Michael Nitschinger has written up a post looking at avoiding nulls in your applications in favor of a better kind of value handling - the introduction of "Optional" handling.

While every developer has kind of accepted their existence, they are suddenly there when we'd desperately need them to not show up. How often did you writeif($obj === null) in your PHP code? Can't there be a better, more elegant and fault-tolerant solution to the problem?

His solution is to create a PHP version of this "Optional" functionality (via an abstract class) that allows some evaluation of the returned value from method calls on the object. Methods like "isPresent", "getOrElse", "of" and "fromNullable" make it easier to work with null values instead of just the triple-equals checking. He includes not only the code for the classes you'll need to implement it but examples of it in use - an "Optional" abstract class and two child classes, "Present" and "Absent".

0 comments voice your opinion now!
avoid null return value optional absent present evaluation tutorial


Jani Hartikainen:
Parsing and evaluating PHP in Haskell Part 1
January 17, 2013 @ 11:13:23

Jani Hartikainen has posted the first part of a series of articles sharing his experiences with an experiment he's conducting - trying to parse and evaluate PHP in Haskell.

The other day I uploaded a new experimental project on GitHub - A Haskell PHP parser / evaluator. It doesn't understand 100% of all PHP syntax, but it was an interesting experiment nevertheless. Here's some insights and other thoughts from working on the code.

He gets the "why?" question out of the way early, noting that it was mainly a desire to play with Haskell and figured parsing something he already knew well was a good first project. He also mentions the "Parsec" library that seems well suited for the parsing part of the process. There were some issues that he came across, however including dealing with PHP's weak typing and handling all of the possible incarnations of PHP script structure. He includes an example AST showing his different data structures (PHPValue, PHPExpr and PHPStmt). The next part of the series will be more about the evaluation of this structure.

0 comments voice your opinion now!
parsing evaluation source haskell project experiment


Programmers.StackExchange.com:
How can I test PHP skills in a interview?
August 16, 2012 @ 11:35:38

In this recent post to the "Programmers" area of the StackExchange site, the user asks the community for help in testing a PHP developer during the interview process to asses their level of knowledge accurately.

My company needs to hire a PHP developer, but nobody has PHP knowledge in my company and we find difficult to test for PHP skills. If it were a C/Java developer I would ask him to write a quick implementation of the Game of Life, but PHP is a completely different language. I saw this test with interest. Anyone else has more suggestions?

There's several other suggestions made touching on a wide range of evaluations including:

  • Security concerns (like SQL injection)
  • Debugging/Profiling
  • Framework experience
  • Good overall development skills
  • And inks to other similar questions
0 comments voice your opinion now!
test interview skills developer development evaluation


Fortrabbit.com:
Cloudscapes - Comparing PHP Cloud Hosting Platforms
July 11, 2012 @ 11:27:07

On the Fortrabbit.com blog there's a new post that does a quick overview and comparison of 11 of the more popular cloud-based hosting platforms out there that are PHP friendly.

We are currently building yet another PHP Cloud Platform ourselves. Of course we looked around to see what the others are up to. This is my (Franks) personal point of view of the current market situation showcasing my favorite services. I try not to judge, neither i will compare features nor prices.

Services on his list include:

0 comments voice your opinion now!
cloudscapes cloud hosting provider evaluation


Web Species Blog:
Lazy evaluation with PHP
June 01, 2011 @ 08:41:01

Juozas Kaziukenas has a new post to his Web Species blog about using "lazy evaluation" in PHP - loading the resources you need for execution and evaluation only as you need them, not all up front.

Recently I needed to process a huge array of data and because of PHP's somewhat inefficient variables and especially arrays that was resulting in "out of memory" errors. However, I couldn't use any other tools than PHP so was forced to come up with a solution implementation in it. Here is how I solved it using principles from functional languages.

He gives an example using Haskell to generate a Fibonacci sequence using its built-in lazy evaluation abilities. Unfortunately, PHP doesn't have such a thing built in, so he tries the next best thing - Iterators. He caries the idea over to the database side too, recommending fetch() in a loop over fetchAll() and some effective joins.

0 comments voice your opinion now!
lazy evaluation haskell functional iterator


Andrei Zmievski's Blog:
PHP 6 and Request Decoding
February 22, 2007 @ 07:49:00

Andrei Zmievski has posted something new to his blog today about a feature of PHP6 that's finally been hammered down - HTTP input (request) decoding.

There have been no fewer than 4 different proposals floated before, but this one combines flexibility, performance, intuitiveness, and minimal architectural changes, and has only a couple of small drawbacks. Let's take a closer look.

He details the functionality - what it is, what's been decided on, and the advantages of the method. The basic approach is a "lazy" one where PHP will only store the request when it comes in, no filtering or anything, until you want to do something with it (i.e. get it via $_GET, $_POST, etc). When the request for data is made, PHP looks at the encoding settings and formats the data accordingly.

Advantages he mentions for this method include removing the guess-work on PHP's part for which encoding the request is and that it removes some of the overhead by not processing the data until it's actually needed.

0 comments voice your opinion now!
php6 decoding request lazy evaluation scheme php6 decoding request lazy evaluation scheme



Community Events





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


community package voicesoftheelephpant install introduction deployment symfony laravel series api release library bugfix language interview framework unittest zendserver opinion podcast

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