Guest User

Untitled

a guest
Oct 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.80 KB | None | 0 0
  1. private function addch_fr_arr($dom,$root,$parametrs){
  2.         foreach ($parametrs as $key=>$value){
  3.             $child_name=$key;
  4.             $child_value = '';
  5.             $array_attr = '';
  6.             $child_array = '';
  7.             if (empty($value)) {
  8.                 $child=$this->add_child($dom,$root,$child_name,$child_value,$array_attr);
  9.                 //throw new Exception("Пустой xml",2);
  10.             } else {
  11.                 foreach ($value as $key=>$value){
  12.                     if ($key===0){
  13.                         $child_value=$value;
  14.                     } elseif ($key=="attr"){
  15.                         $array_attr = $value;
  16.                     } elseif ($key=="child"){
  17.                         $child_array=$value;
  18.                     } else {
  19.                         $child_value=$value;
  20.                     }
  21.                 }
  22.                 $child=$this->add_child($dom,$root,$child_name,$child_value,$array_attr);
  23.                 unset($child_value);
  24.                 if (is_array($child_array)) $this->addch_fr_arr($dom,$child,$child_array);
  25.             }
  26.         }
  27.     }
Add Comment
Please, Sign In to add comment