Advertisement
Arkanium77

PHPидорам

Nov 5th, 2017
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.92 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <!--
  3. To change this license header, choose License Headers in Project Properties.
  4. To change this template file, choose Tools | Templates
  5. and open the template in the editor.
  6. -->
  7. <html>
  8.  
  9.     <head>
  10.         <meta charset="UTF-8">
  11.         <title>Задание 6</title>
  12.         <link rel="stylesheet" href="center.css" type="text/css">
  13.         <link rel="shortcut icon" href="u.gif" type="image/gif">
  14.         <style>
  15.  
  16.         </style>
  17.     </head>
  18.  
  19.     <body>
  20.         <figure class="center">
  21.             <img src="zz.png">
  22.             <br>
  23.             ____________________________________________________________________<br>
  24.  
  25.  
  26.             <?php
  27.             var_dump($GLOBALS['ar']);
  28.             if ($GLOBALS['ar'] != NULL) {
  29.                 echo "Текущее состояние массива:<br>[";
  30.                 for ($i = 0; $i < (count($GLOBALS['ar']) - 1); $i++) {
  31.                     echo " " . $GLOBALS['ar'][$i] . " |";
  32.                 }
  33.                 echo " " . $GLOBALS['ar'][count($GLOBALS['ar'])] . " ]";
  34.                 echo "<br>";
  35.                 echo "Введите дополнительные значения для массива:";
  36.             } else {
  37.                 echo "Введите значения для массива через запятую:";
  38.                 $GLOBALS['ar'] = array();
  39.             }
  40.             ?>
  41.             <form action="index.php" method="get">
  42.                 <input type="text" name="ar"><br>
  43.                 <input type="submit" value="Подтвердить">
  44.             </form>
  45.             <?php
  46.             $c = filter_input(INPUT_GET, 'ar');
  47.             echo "<br>$c<br>";
  48.             $c = str_replace(", ", ",", $c);
  49.             $c = str_replace(" ,", ",", $c);
  50.             $GLOBALS['ar'] = array_merge($GLOBALS['ar'], explode(",", $c));
  51.             print_r($GLOBALS['ar']);
  52.             ?>
  53.         </figure>
  54.     </body>
  55. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement