Skip to content

Instantly share code, notes, and snippets.

@marek-saji
Created March 21, 2012 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marek-saji/2146399 to your computer and use it in GitHub Desktop.
Save marek-saji/2146399 to your computer and use it in GitHub Desktop.
<?php
error_reporting(E_ALL | E_STRICT);
$foo = array('hello', ' ', 'world', '.');
$prefix = uniqid('♠');
extract($foo, EXTR_PREFIX_ALL|EXTR_REFS, $prefix);
$prefix .= '_';
for ($i = -1 ; isset(${$prefix . ++$i}) ;)
{
echo ${$prefix . $i};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment