Apache Benchmarking, Foreach with List and Other PHP 5.5 Stuff

Cool little tool for benchmarking which you have, if you have apache installed:

ab -n 100 -c 5 http://localhost/site.php

This says to test a page 100 times with a concurrency of 5. Apache will spit back some stats on it. Pretty cool.

Also, did anyone else know that you can use list in foreach loops now?

foreach ($array_of_stuff as list($other, $arr, $of, $stuff)) {
    echo $other;
    echo $arr;
    echo $of;
    echo $stuff;

Makes it super handy and way more readable than:

foreach ($array_of_stuff as $items) {
    echo $items[0];
    echo $items['things'];
    echo $items[2];
    echo $items[3];


PHP finally added a “finally” block to their try -> catch block:

try {
    // do this
} catch(Exception $e) {
    // handle errors
} finally {
    // do this regardless afterward

Super easy.

Leave a Reply

Your email address will not be published. Required fields are marked *