News Feed

News Archive
feed this:

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

Allan MacGregor:
Hello Hack
March 25, 2014 @ 09:50:33

Allan MacGregor has a new post to his site introducing you to Hack, the recently released language from Facebook based on their work with the HipHop virtual machine.

Recently Facebook unveiled Hack, a new programming language that aims to provide developers with the tools to write and ship code quickly while catching errors on the fly. Hack is as programming language designed to work with HHVM and the same time it works seamlessly with PHP as Facebook lead devs. [...] So does that mean that Hack is just a faster more efficient PHP implementation, right? Wrong, Hack is much more than that, the language brings features that are normally found in statically typed languages to the dynamically typed world of PHP.

He focuses in on the static typing functionality of Hack a bit more and includes an example of PHP code where Hack would catch the type shifting. He also briefly mentions some of the other features including built-in collections, traits, generics and asynchronous programming.

0 comments voice your opinion now!
hack facebook language introduction typing

The Duck is a Lie
June 27, 2012 @ 09:55:22

In this recent post to Giorgio Sironi looks at duck typing and compares it in a few different languages (PHP, Ruby and Java). "Duck typing" is where the methods/functions define the structure or common interface rather than being functional.

What follows is my experience with Java, PHP and Ruby. I mainly use PHP as a dynamic language that supports duck typing but also the definition of Java-like interfaces, but does not force any of the two approaches as you can define interfaces whose method arguments accept any variable or not using interfaces at all. Is duck typing that a revolution?

He shares some of the common misconceptions he's seen including the idea that duck typing can help completely different objects work together and that, sometimes, despite naming conventions, functionality was intended to be different. He shows how even interfaces in PHP can be implemented loosely and the "acts as" and "single callback" architecture ideas.

0 comments voice your opinion now!
duck typing interface misconception actsas callback

Pim Elshoff's Blog:
In favour of typing
April 25, 2012 @ 13:57:38

Pim Elshoff has a new post to his blog that shares his preference on typing (keystrokes, not variables) in applications (hint: he likes it):

We sometimes conceive of ideas that are arduous to express in code. Like persisting data, or some other uncommon task (sarcasm). It's not difficult, but it takes a lot of keystrokes to write. Being problem solvers, we find it difficult doing this kind of manual labour, especially when machines can do it for us. Still, I would like to take this opportunity to say that typing rocks and solutions that save typing suck.

He talks about the abstraction that frameworks provide (less typing, more work) and and some of the "magic" that comes with them. He gives specific examples of some of his pervious experience with frameworks (including some pains with Symfony2) and how some of the magic he's seen is easy to write but hard to read.

0 comments voice your opinion now!
favor typing keystrokes framework magic opinion

Evert Pot's Blog:
Numeric string comparison in PHP
April 26, 2011 @ 09:23:47

In this new post to his blog Evert Pot reminds you (the PHP developer) about the loose and strict typing checks that you need to do when checking the values of your variables and never just assume. PHP's loose typing tendencies can cause issues if you're not paying attention.

As long as you make sure you always use strict checking (=== and !==) where you can, and fall back to the loose checks when you must. As a PHP developer, I think it's very important to understand and memorize exactly how these work, whether you're writing new code, or maintaining existing code.

He points out a specific example of some code that seems counter-intuitive when you compare how it reads and how it actually works (strings converted to floats and evaluated)

The moral is: always do strict checks when you are able to.
0 comments voice your opinion now!
numeric comparison evaluate loose typing typecheck

Giorgio Sironi's Blog:
Java versus PHP
April 16, 2010 @ 10:55:19

In a new post to his blog Giorgio Sironi has a (more balanced) comparison of Java versus PHP that them on topics like how they handle typing and their execution models.

If you exclude C and its child C++, the most popular programming languages in the world are Java and PHP, which power most of the dynamic web. I have working experience with PHP and for academical purposes I am deepening my knowledge of Java, thus I'd like to point out similarities and key differences between these two languages. Every language has its pros and cons, so there's no absolute winner here.

He briefly covers their history, java's static versus PHP's dynamic typing, how they both handle objects, their execution plans and how easy they are to deploy when it comes to general applications.

0 comments voice your opinion now!
java comparison typing oop execution infrastructure

Jani Hartikainen's Blog:
Static/Dynamic typing sweet spot
October 08, 2008 @ 10:24:28

In a new post today Jani Hartikainen takes a look at one of the things that makes PHP both powerful and unpredictable at times - its variable typing, static versus dynamic.

It seems that PHP has moved a bit towards static typing, and languages like C# seem to be implementing some dynamic features. Are we going towards a "mixed" language with static and dynamic typing? What's the "sweet spot" between completely static (like C++) and completely dynamic typing (like Python)?

He compares the benefits of static and dynamic, and a particular place where PHP falls a bit flat - type hinting in certain situations. He agrees, though, that dynamic typing is "the way to go" since it gives the developer the flexibility they might need for more "typing tricks" in their apps. Oh, and "duck typing"...

0 comments voice your opinion now!
static dynamic typing type variable hint compare

Matthew Turland's Blog:
The Yin and Yang of Typing
February 01, 2008 @ 11:58:00

A little while back Matthew Turland posted about something that some developers moving over to PHP from more strict languages have an issue with - variable typing - and how its evolved in languages over time.

Without a little background in programming languages or computer science in general, it's entirely possible that typing systems are not something that have crossed your mind. I thought I'd take a blog entry to share some of my thoughts on how it's affecting the creation and evolution of languages.

He walks through history a bit, mentioning C, Java, Python and PHP and how they differ in their default type handling. He especially focuses on the "blurred line" between strong and weak typing and how some if offers special features to the language that uses the method.

0 comments voice your opinion now!
typing strong weak strict dynamic java python c

Nick Halstead's Blog:
Do faster typists make better coders?
July 25, 2007 @ 14:51:04

Nick Halstead asks an interesting question on his blog today - "Do faster typists make better coders?"

I have been able to touch type since about age 12 and can manage about 100 words per minute when faced with blocks of text to copy and even faster if I am just writing code. [...] Programming in C meant a lot more typing of parenthesis and a lot more thinking about the structure of the code.

PHP has introduced another set of typing problems with a lot more use of < > and a much higher mixture of variables/functions/parenthesis plus the added bonus of trying to remember a single function from a choice of 3000+.

Several of the comments on the post suggest that it could be helpful to productivity, but shouldn't be focused on too much. After all, what really matters is the programmers skill, right?

3 comments voice your opinion now!
faster typist better coder productive typing problem faster typist better coder productive typing problem

Brian Moon's Blog:
Initializing & typing variables with settype()
September 14, 2006 @ 07:01:47

In his latest post, Brian Moon talks about a method to help you and your code fit into an E_STRICT style of coding - the settype function.

These days, the way to develop is to have E_ALL and maybe even throw in E_STRICT if you are really hard core. That of course means having all your variables initialized before they are used.

In his view, defining them is good, but it's more "elegant" to use the settype function to make it more clear where they are defined. He also includes a function, using settype, that ensures that the entered values are what they should be (i.e. and int is an int).

0 comments voice your opinion now!
initializing typing variables settype declare e_strict initializing typing variables settype declare e_strict

Community Events

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

library api example conference laravel php7 interview extension series framework symfony2 community version application performance voicesoftheelephpant opinion release introduction podcast

All content copyright, 2015 :: - Powered by the Solar PHP Framework