Advertisement
eimkasp

In array example PHP

Oct 12th, 2016
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.30 KB | None | 0 0
  1. <?php
  2.     $skaiciai = [1,2,3,4,5,6];
  3.  
  4.     $istrinti = [1,3];
  5.     $rezultatuMasyvas = [];
  6.  
  7.     for($i = 0; $i < count($skaiciai); $i++) {
  8.  
  9.         if(in_array($i, $istrinti)) {
  10.             echo "sita reikia istrinti";
  11.         } else {
  12.             array_push($rezultatuMasyvas, $skaiciai[$i]);
  13.         }
  14.     }
  15.  
  16.     var_dump($rezultatuMasyvas);
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement