Advertisement
jargon

Clean Configuration

Sep 30th, 2021
1,421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.38 KB | None | 0 0
  1. function trk_cleancfg( &$config = array() )
  2. {
  3.     $config_temp = $config;
  4.     $config = array();
  5.    
  6.     foreach( $config_temp as $k => $v )
  7.     {
  8.         if( is_integer( $k ) )
  9.         {
  10.             if( is_array( $v ) )
  11.             {
  12.                 foreach( $v as $k2 => $v2 )
  13.                 {
  14.                     $config[ $k2 ] = $v2;
  15.                 }
  16.             }
  17.             elseif( is_string( $v ) )
  18.             {
  19.                 $config[ $v ] = '';
  20.             }
  21.         }
  22.     }
  23.        
  24.     unset( $config_temp );
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement