Check if a piece of HTML code contains a classnameCheck if a piece of HTML code contains a classname

<?php
/**
 * Check if a piece of HTML code contains a classname. 
 */
function _html_has_classname($classname) {
  return 
preg_match_all("/class=\"(([\w-]*[\s]+)*)$classname(([\s]+[\w-]*)*)\"/"$classname);
}
?>

Snippets Tags: 

Reactie toevoegen

Ververs Geef de karakters in die u in de afbeelding ziet. Type the characters you see in the picture; if you can't read them, submit the form and a new image will be generated. Not case sensitive.  Switch to audio verification.