Guest User

Untitled

a guest
Oct 17th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. function stripComments(DOMNode $node)
  2. {
  3.     $name = $node->nodeName;
  4.     if ((substr_count($name, "#") > 0) && (strpos($name, "#") == 0))
  5.     {
  6.         return $node->nextSibling;
  7.     }
  8.     return $node;
  9. }
  10.  
  11. $i = 0;
  12. while($character != NULL)
  13. {
  14.     if(isComment($character))
  15.         $character = $character->nextSibling;
  16.        
  17.     $literalNode = stripComments($character->firstChild);
  18.    
  19.     echo $literalNode->nodeName;
  20.    
  21.     $character = $character->nextSibling;
  22.    
  23.     $i++;
  24.     if ($i > 10)
  25.         break;
  26. }
Add Comment
Please, Sign In to add comment