01-05-2008, 02:59 AM
|
#14 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
|
Quote:
Originally Posted by Salathe
Disclaimer: I hold no responsibility for any physical or mental injury to yourself or those in your immediate vicinity caused as a direct result of looking at my method of swapping the variables' values. You have been warned.
PHP Code:
$a = 1; $b = 2;
/* 1 */ $szStory = 'The quick brown fox jumps over the lazy dog. How awesome is that?'; /* 2 */ $aMess = compact(array_unique(str_split(preg_replace('/[^a-z]+/', '', strtolower($szStory))))); /* 3 */ foreach (array_reverse(array_keys($aMess)) as $iKey => $szVar) /* 4 */ (isset($pMess) or $pMess = new stdClass) and $aTemp = array_values($aMess) and $pMess->$szVar = $aTemp[$iKey]; /* 5 */ for($iPos = 0, $iLen = count($aPos = array(2, 17, -2, 8, 32, 2, -6)); $iPos < $iLen; $iPos++) /* 6 */ (isset($szFunc) or $szFunc = '' or 0123 === 0x53) and $szFunc .= strtolower($szStory[$iPos + $aPos[$iPos]]); /* 7 */ $szFunc(get_object_vars($pMess)); /* 8 */ unset($szStory, $aMess, $iKey, $szVar, $pMess, $aTemp, $iPos, $iLen, $aPos, $szFunc);
// Now, magically, $a = 2 and $b = 1... don't ask how. header('Content-Type: text/plain; charset=utf-8'); var_dump($a, $b);
|
Hurts to read, but when formatted better it makes some amount of sense. I have a rough idea of what it does.
|
|
|
|