code: private static function resetLocaleTo($localeSaved)
      {
          $localeData = explode(';', $localeSaved);
          
          foreach ($localeData as $identifier) {
              if (! strchr($identifier, '=')) {
                  continue;
              }
              $type = $value = null;
              sscanf($identifier, "%s=%s", $type, $value);
              switch ($type) {
                  case 'LC_ALL':
                      setlocale(LC_ALL, $value);
                      break;
                  
                  case 'LC_COLLATE':
                      setlocale(LC_COLLATE, $value);
                      break;
                  
                  case 'LC_CTYPE':
                      setlocale(LC_CTYPE, $value);
                      break;
                  
                  case 'LC_MONETARY':
                      setlocale(LC_MONETARY, $value);
                      break;
                  
                  case 'LC_NUMERIC':
                      setlocale(LC_NUMERIC, $value);
                      break;
                  
                  case 'LC_TIME':
                      setlocale(LC_TIME, $value);
                      break;
                  
                  case 'LC_MESSAGES':
                      setlocale(LC_MESSAGES, $value);
                      break;
                  
                  default:
                      ;
                      break;
              }
          }
      }
docs: Reset the locale settings back to saved vars
  
  @param string $localeSaved
  String containing the locale infos obtained using setlocale(LC_ALL, '');