01-04-2008, 09:29 PM
|
#8 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
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);
|
|
|
|