daily pastebin goal
59%
SHARE
TWEET

Quest_PHP1_task7

dzimmo Jun 1st, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. //создаем свое пространство имен MyNewNamespace
  3. namespace MyNewNamespace;
  4.  
  5. //Описываем встроенную функцию print_r, и интерпретатор не выдает ошибку т.к. мы находимся
  6. //не в глобальном пространстве имен в собственном, в котором нет функции print_r
  7. function print_r($phpCode){
  8. echo "<pre> <code class='php'> $phpCode </code></pre>";
  9. }
  10. if (isset($_POST["php_text"])){
  11.    $php_text = str_replace("<?php","" ,$_POST["php_text"]);
  12. }
  13. ?>
  14.  
  15. <!DOCTYPE html>
  16. <html lang="en">
  17. <head>
  18.     <meta charset="UTF-8">
  19.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  20.     <meta http-equiv="X-UA-Compatible" content="ie=edge">
  21.     <title>Document</title>
  22.     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
  23. </head>
  24. <body>
  25. <div class="container">
  26. <form method="post">
  27.     <label for="php_text">Введите код на языке PHP</label>
  28.     <input type="text" name="php_text" class="form-control" style="min-height:100px;"/>
  29.     <input type="submit" value="Submit" class="btn btn-primary mb-2"/>
  30. </form>
  31.  
  32.     <div class="border border-dark" style="min-height: 300px;">
  33.         <?php  print_r($php_text); ?>
  34.     </div>
  35. </div>
  36. </body>
  37. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top