Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.26 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4.     <?php include_once('../shared/meta.php') ?>
  5.     <title>Comic book duos</title>
  6. </head>
  7. <body>
  8.     <?php include_once('../shared/nav.php') ?>
  9.     <main>
  10.         <h1>Comic book duos</h1>
  11.         <?php
  12.         $characters1 = ['Suske', 'Willy', 'Kuifje', 'Tintin', 'Jommeke', 'Jeremy'];
  13.         $characters2 = ['Wiske', 'Wanda', 'Bobby', 'Snowy', 'Filiberke', 'Frankie'];
  14.  
  15.         echo "<h2> Dutch names </h2>";
  16.  
  17.         for ($i = 0; $i < count($characters1); $i++) {
  18.             if ($i % 2 == 0) {
  19.                 echo "<li> $characters1[$i] en $characters2[$i]  </li>\n";
  20.             }
  21.         }
  22.  
  23.         echo "<h2> English names </h2>";
  24.  
  25.         for ($i = 0; $i < count($characters2); $i++) {
  26.             if ($i % 2 != 0){
  27.                 echo "<li> $characters1[$i] and $characters2[$i]  </li>\n";
  28.             }
  29.         }
  30.  
  31.         ?>
  32.  
  33.         <hr>
  34.         <blockquote class="icon-gray-pen">
  35.             <ul>
  36.                 <li>Create an array <code>$characters1</code> with values 'Suske', 'Willy', 'Kuifje', 'Tintin',
  37.                     'Jommeke' and 'Jeremy'
  38.                 </li>
  39.                 <li>Create an array <code>$characters2</code> with values 'Wiske', 'Wanda', 'Bobby', 'Snowy',
  40.                     'Filiberke' and 'Frankie'
  41.                 </li>
  42.                 <li><b>Dutch names</b>: concatenate (use the word 'en') and print the corresponding comic characters
  43.                     with an <b>even index</b> in both arrays
  44.                     <ul>
  45.                         <li>Suske en Wiske</li>
  46.                         <li>Kuifje en Bobby</li>
  47.                         <li>Jommeke en Filiberke</li>
  48.                     </ul>
  49.                 </li>
  50.                 <li><b>English names</b>: concatenate (use the word 'and') and print the corresponding comic characters
  51.                     with an <b>odd index</b> in both
  52.                     arrays
  53.                     <ul>
  54.                         <li>Willy and Wanda</li>
  55.                         <li>Tintin and Snowy</li>
  56.                         <li>Jeremy and Frankie</li>
  57.                     </ul>
  58.                 </li>
  59.             </ul>
  60.         </blockquote>
  61.     </main>
  62.     <?php include_once('../shared/footer.php') ?>
  63. </body>
  64. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement