×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: lenphp
Added: Mar 14, 2013 6:28 AM
Views: 32
This function code must hide and call it in the first line of the php code.

I use it in my work, when my boss ask me make website validity.
  1. <?php
  2. function valid_this()
  3. {
  4.     $valid_html = <<<EOD
  5. </title>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. </head>
  8. <body>
  9. </body>
  10. </html>
  11. EOD;
  12.     if ($_SERVER['HTTP_USER_AGENT'] == "W3C_Validator/1.3") {
  13.         echo $valid_html;
  14.         exit();
  15.     }
  16. }
  17. ?>