PHP

The slums of the
Programming World?

Jurgens du Toit / jrgns — jrgns.net / @jrgns

Why talk about PHP?

A short history of PHP

Written by Rasmus Lerdorf to replace repetitive coding CGI calls.

Replaced the original parser with the Zend Engine, Zend Engine 2.

"I've never thought of PHP as more than a simple tool to solve problems"
— Rasmus Lerdorf

Who uses PHP

  1. User facing portions of Facebook (through HipHop)
  2. Wordpress
  3. Yahoo (for now)
  4. Wikipedia / Mediawiki

Lies, Damned Lies and...

TIOBE Language Index

Web Language Trends

Framework Trends

PHP Framework Trends

PHP Usage

Web Jobs

Web Jobs Growth

Web Jobs Growth with Ruby

Embrace the Cactus

  1. Language
  2. Community
  3. Toolset

Language

Inconsistencies in naming functions:


strrev     // String Function
str_repeat // String Function
explode    // String Function
// At least somewhat consistent
strpos($haystack, $needle)
array_key_exists($needle, $haystack)
                      

Potentially Insecure:


                          mysql_query("SELECT * FROM `users` WHERE `username` = $_GET['username']");
                      

  • PHP accounts for only 18% of applications covered by the CVE, but accounts for almost 29% of the vulnerabilities
  • Not Object Oriented, just Object Capable
  • Low barrier to entry?

Community

Bringing a knife to a gun fight is like bringing PHP to a modern web stack.
—@iamdevloper

Tabs Not Spaces Slugfest

Toolset

In general not too bad, but managing dependencies with PEAR is a pain.

Noteworthy tools / libraries:

  1. XDebug
  2. PHPUnit
  3. SwiftMailer

The flip side of the coin

  1. Language
  2. Community
  3. Toolset

PHP 5.3

  1. Namespaces
  2. Closures and Lambda functions
  3. Renewed focus on security by default

PHP-FIG

  1. It's been a bumpy ride... but worth it
  2. Unofficial
  3. Yet widely adopted

Composer / Packagist

  1. PEAR shaped
  2. Now we can manage dependencies and versions
  3. Dead simple:
    composer require "vendor/library"

Modern Frameworks

  1. Symfony 2
  2. Zend 2
  3. Laravel
  4. Lithium
  5. PPI

So... Slums?

If you can pull it off, you’re badass as hell, but most of the time you’re only going to end up stabbing yourself. - @ohpalmer

Questions / Missiles