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.
/*
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>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment