Skip to content

Instantly share code, notes, and snippets.

@clouddueling
Forked from anonymous/whitespace_test.php
Created December 18, 2012 18:47
Show Gist options
  • Save clouddueling/4330767 to your computer and use it in GitHub Desktop.
Save clouddueling/4330767 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Dec 18, 2012.
    23 changes: 23 additions & 0 deletions whitespace_test.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    /*
    Note the white space in the $page variable.
    $page is set somewhere up here and is being concatenated upon.

    These units are in bytes.
    Sourced from: http://stackoverflow.com/questions/2192657/how-to-determine-the-memory-footprint-size-of-a-variable
    */

    // WITHOUT WHITE SPACE: http://screencloud.net/img/screenshots/e5c9b31c4b20021082c22a551fca903c.png
    $start_memory = memory_get_usage();
    $page .= "<div class='item'><div class='row-fluid'><div class='span10 offset1'>";
    echo memory_get_usage() - $start_memory;
    echo '<br>';

    // WITH WHITESPACE: http://screencloud.net/img/screenshots/e5c9b31c4b20021082c22a551fca903c.png
    $start_memory = memory_get_usage();
    $page .= "
    <div class='item'>
    <div class='row-fluid'>
    <div class='span10 offset1'>
    ";
    echo memory_get_usage() - $start_memory;
    echo '<br>';