If you’ve ever used Go it’s hard to not find returning multiple values from functions conspicuously absent in other languages. In this case, we’ll look at a simple way to implement the same design pattern effectively in PHP. Why It’s Useful So why return multiple values from a function anyway? If you’ve never used Golang or a similar language which allows that, it may not be readily obvious. Most use-cases in Golang are centered around errors, so it’s very easy to check if a function encountered a error.
Installing APC and/or Xdebug for PHP on Ubuntu 14.04 isn’t hard, but requires knowing a few small bits of information, particularly if you’re planning on using Xdebug with command-line PHP scripts. Install Xdebug If You Don’t Need Xdebug on CLI If you need Xdebug only through Apache, installing it is as simple as: sudo apt-get install php5-xdebug If you need Xdebug on the command-line (CLI) then it’s a bit more work, since it’s Xdebug on the command-line via the php5-xdebug package is disabled.
This took a bit to figure out, so I’m posting it here in hopes it may be helpful. I use the Silex microframework a lot, and love it. Setting up testing, though, can be a bit tricky if you don’t know what to look for. First off, the docs on the Silex site are great. They will definitely get you started, but they seem to be missing a couple of critical explanations that may trip you up.