Created
August 18, 2012 14:49
-
-
Save flesch/3387199 to your computer and use it in GitHub Desktop.
document::getElementsByClassName("")
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class document { | |
public static function getElementsByClassName($name) { | |
global $xpath; | |
$nodes = array(); | |
$elements = $xpath->query(sprintf("//div[contains(@class, '%s')]", $name)); | |
foreach ($elements as $e) { | |
array_push($nodes, $e); | |
} | |
return $nodes; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a lot !
Still usefull eleven years later !