tidyNode::hasChildren
(PHP 5 >= 5.0.1)
tidyNode::hasChildren — Indique si le noeud a des enfants
Description
bool tidyNode::hasChildren
( void
)
Indique si le noeud courant a des enfants.
Valeurs de retour
Retourne TRUE
si le noeud a des enfants,
FALSE
sinon.
Exemples
Exemple #1 Exemple avec tidyNode::hasChildren()
- <?php
- $html = <<< HTML
- <html><head>
- <?php echo '<title>title</title>'; ?>
- <#
- /* code JSTE */
- alert('Hello World');
- #>
- </head>
- <body>
- <?php
- // code PHP
- echo 'hello world!';
- ?>
- <%
- /* code ASP */
- response.write("Hello World!")
- %>
- <!-- Comments -->
- Hello World
- </body></html>
- Outside HTML
- HTML;
- $tidy = tidy_parse_string($html);
- $num = 0;
- // La balise head
- var_dump($tidy->html()->child[0]->hasChildren());
- // Le PHP dans la balise head
- var_dump($tidy->html()->child[0]->child[0]->hasChildren());
- ?>
L'exemple ci-dessus va afficher :
bool(true) bool(false)
Notes
Note:
Cette fonction était appelée tidy_node::has_children() dans PHP 4/Tidy 1.