All pastes #426594 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-04-06 07:22 UTC
rendered paste body
<?php

function foo($refresh = FALSE) {
  static $storage;
  if ($refresh) {
    unset($storage);
  }

  if (!isset($storage)) {
    $x = new stdClass();
    $x->t = microtime();
    $storage[$x->t] = $x;
  }
  return $storage;
}

var_dump(foo());
var_dump(foo(TRUE));
var_dump(foo());