$var = 'a'; { $tmp = $var; $var = 'whatever_I_want'; ... #at end of scope $var = $tmp; }