The PHP podcast where everyone chimes in.

Originally aired on

October 19th, 2014

005: PHP Internals - Past, Present & Future

How the sausage is made. Taking a look at PHP's history and where it's going in the future.

with


PHP Internals - Past, Present & Future Show Summary


  • 2:00 - Guest Introductions
  • 4:00 - Show Begins
  • 4:15 - Op code pops up alot in PHP Internals. Machine readable version of your script, it's what PHP actually steps through as it is executing your program.
  • 5:50 - PECL - pronounced pickle - PHP Extension Community Library
  • 6:25 - 3v4l.org - a site that allows you to run your code in a bunch of different versions at the same time. Also shows the op code for php and hhvm
  • 7:46 - Leet speak
  • 7:56 - JIT - Just in time compiler, a description follows but I can't really hear it.
  • 9:00 - PHPPHP - implementation of php written in php instead of C. Should be able to run your code by PHPPHP and get the same output as C
  • 10:00 - PHP with JIT is the same sort of thing, it's a separate program whose only job is to run your program. Your program is not running, JIT is running your program. JIT allows your program to run your php directly on the CPU.
  • 11:00 - There is discussion of included JIT in PHP, but no one seems to have a good stable one at the moment.
  • 12:00 - With Zend engine, you can run extensions and configure them, with JIT it would be significantly harder to do that unless it was perfectly right.
  • 12:50 - HHVM allows you to do things you probably shouldn't be doing.
  • 13:20 - PHP is really good at running really bad code, really well.
  • 13:30 - Done is better than perfect.
  • 13:45 - PHP drinking game introduced by @jmikola
  • 14:38 - Userland, refers to people who write php
  • 15:30 - What are extensions?
  • Extensions are C code that ties into PHP itself. Can either add functionality, change the way the engine runs, or do other bad things that will be kept secret.
  • 16:10 - PHP is two things, the Zend engine, that parses the script, and the other side of that is the runtime library. Made up of all these extensions, without the extensions, php would be a really boring language.
  • 16:46 - 4,000 extensions ship with php
  • 16:55 - You can write your own extensions.
  • 17:50 - extensions probably not included in term "userland"
  • 18:00 - Talk about where php came from...basically to make writing something in C easier.
  • 19:00 - PERL was the only really established language. Ruby was there, but really young,
  • 20:30 - PHP - stands for Personal Home Page - first release of php was 1995
  • 22:15 - PHP Museum
  • 23:00 - Anything from php past that is still plaguing it? Parameter Order
  • 24:30 - Funny that php PSR-2 requires spaces, and the code that runs php (C) uses tabs.
  • 25:00 - FIG - the PHP standards group, where the PSR-X standards come from.
  • Solving simple problems that are going to be generically useful, is a lot more useful to thee public than trying to build a one-size-fits all solution.
  • Fig should build complexity by composing simplicity
  • 28:30 - The people behind PHP Internals don't even use PHP. This idea turns out to be false.
  • 30:30 - Userland is best used to describe the code that is used to compile php vs php that runs on the process
  • 31:00 - Should the people who write the C code that compiles php be concerned with things like PHP FIG?
  • 31:20 - Internals should enable php community, but should also listen to community if there is a consensus that arises from usage.
  • 33:00 - Talk about GOTO being added to php, and some things that surrounded that action.
  • The argument basically being that, if it's there and you want to use it, you can, if not, then don't use it.
  • An example is made that GOTO solved great, sort of a discussion about the identity of PHP. PHP vs JAVA being a designed language and very academic in its approach.
  • 36:00 - premature optimization is the root of evil.
  • 37:00 - Why aren't arrays allowed to be a constant? Constants are done at compile time (technical jargon answer). PHP's numbering model is partly to blame. Constants are limited to (what we call) scalar values (null, true, false, integer, floats, string). String is technically not a scalar, but it's close enough that PHP sort of pretends it is one. In php 5.5, the ability to dereference an array entered.
  • Arrays are basically mutable structures from the very concept of them.
  • 40:00 - Mutable vs Immutable - Basically, mutable means you can change the value when the script runs. Immutable, you can not. Constants are immutable, so making Arrays constants is a little weird.
  • 41:10 - Why are Resources skipped when talking about primitives? Resources are pointers behind a "dark magical curtain". PHP knows nothing about them. The only thing that does are things in that same extension.
  • An example of a resource is the File Pointer. Changing the File Pointer to objects would require everyone to rewrite parts of their program.
  • If you want to get rid of resources, why not get rid of arrays and replace them with objects? Objects do everything arrays do, plus a little bit.
  • 44:30 - An argument is made to figure out a good way to transition from resources to objects.
  • 45:10 - Discussion about how to help out with PHP ecosystem that doesn't require person to know C code. PHP.net, tests, and more do not require C
  • 47:00 - The code that runs PHP.net is very interesting to look at...some dates back to PHP 3.
  • 48:50 - qa.php.net - tools to help write tests for php.net (and other usecases)
  • gcov.php.net - code coverage for php.net
  • 50:00 - all tests for php are integration tests...no unit tests
  • 52:30 - PHP Future - A spec for PHP. A specification that defines everything for PHP.
  • 53:00 - PHP's strength is that it is not an academic approach, it is driven by people who need to solve problems and provide solutions.
  • Since there is no spec for php, the source code is the spec...which seems to work ok
  • 54:30 - PHPNG
  • 55:50 - A PHP spec is probably a good idea, but no one wants to be in that work.
  • 57:00 - 0x00 + 2 = 4 in PHP 5.3, is one of the "warts" that has been found by someone writing a spec for PHP...that sounds like it was paid for by facebook (sort of). This bug was fixed in 5.3.11
  • HHVM has north of 12,000 unit tests.
  • PHPT unit tests and unit tests at the C level.
  • 62:45 - RFC process discussed pretty quickly.
  • Biggest threat to PHP in terms of what would be a concern that could derail the project? First answer was Apathy. If no one puts in interest, or no new blood joins the project. Eventually, there could be no one to carry the torch.
  • 64:00 - The barrier to entry into PHP is both a great thing and a bad thing. You can have complete beginners and very experienced engineers, that a both write PHP.
  • Hacklang is a great prooving ground for PHP...but could be considered a threat if it forks compatability with PHP. So you could have an instance where things only work on Hacklang, or only work in PHP. You know would be splitting the group.
  • That being said though, it has also helped show how some things could work in PHP and has helped get some RFC's done.
  • WordPress accounts for 40% of PHP installs.
  • 67:00 - Continued discussion about WordPress and how it's so widely used that it can dictact some of the direction of PHP
  • 70:00 - beginning of the show wrap up
  • If you want to help out with PHP, hop onto IRC in the PHP mentoring channel and YELL!
  • 75:00 - End of show basically.

Show note credits

A huge thank you to Andrew Huggins for creating the show notes for this episode!

Anthony Ferrara


Sara Golemon

  • Sara is @SaraMG on Twitter
  • She works on getting XP in video games and torturing PHP
  • Works on the XHP extension for PHP - XHTML embedded in PHP

Elizabeth Smith


Joe Watkins


Show Notes Credit

Thank you Andy Huggins for authoring the show notes for this episode!

If you'd like to contribute show notes and totally get credit for it, check out the show-notes repo!