Advertisement
Underworld1337

Untitled

Dec 29th, 2014
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1.     private function addOutput($output, $keep = true){
  2.       $old_output = $this->action_out;
  3.       if($old_output == "Platzhalter")
  4.         $this->action_out = $output;
  5.       else{
  6.         $new_parts = explode("|", $output);
  7.         $old_parts = explode("|", $old_output);
  8.         $new_output = array();
  9.    
  10.         if($keep)
  11.           $new_output[0] = $old_parts[0];
  12.         else
  13.           $new_output[0] = $new_parts[0];
  14.    
  15.         //header rausschneiden
  16.         unset($old_parts[0]);
  17.         //keys neu vergeben
  18.         $ol = array_merge($old_parts);
  19.         // offset -1 letztes paar $k => $v
  20.         // added $x
  21.         $x = array_slice($ol, -1, 1);
  22.         // key = counter
  23.         $c = array_keys($x);
  24.         $nl = $new_parts[1];
  25.         for($i = 0;$i <= $c;$i++){
  26.           $new_output[] = $ol[$i];
  27.           //array_fill($i+1, 1,$ol[$i]);
  28.           if($i == $c)
  29.             $new_output[] = $nl;
  30.         }
  31.         $this->action_out = implode("|", $new_output);
  32.       }
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement