Advertisement
dead__

Untitled

Mar 9th, 2013
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | None | 0 0
  1. <?php
  2.     class XML {
  3.         public static function encode($array) {
  4.             $return = '';
  5.            
  6.             foreach($array as $key => $item){
  7.                 $return .= '<' . $key . '>';
  8.                 if(is_array($item))
  9.                     $return .= self::encode($item);
  10.                 else
  11.                     $return .= "{$item}";
  12.                
  13.                 $return .= '</' . $key . '>';  
  14.             }
  15.             return $return;
  16.         }
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement