testview - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of testview.php

  1. <?php
  2.  
  3. // ficher template à include
  4. class View1 {
  5.     
  6.     public $value = 'une valeur par défaut';
  7.     
  8.     function render() {
  9.         return `?>
  10.         <html>
  11.             <head></head>
  12.             <body>my body
  13.             <span>Value:<?= $value ?></span>
  14.             </body>
  15.         </html>
  16.         <?php`;
  17.     }
  18. }
  19.  
  20.  
  21. // dans le controleur
  22. var view = new View1();
  23. echo view.render();
File Description
  • testview
  • PHP Code
  • 08 Jan-2020
  • 389 Bytes
You can Share it: