jeudi 16 juin 2016

ul li to if else statement in PHP

hello first sorry for my bad english.

here i have some problem with PHP. how i can create / print (if else) statement from ul and li tag.

For example is like the code below:

<ul>
<li>1.1</li>
<ul>
    <li>1.1.1</li>
    <li>1.1.2</li>
</ul>
<li>1.2</li>
<ul>
    <li>1.2.1</li>
    <ul>
        <li>1.2.1.1</li>
        <li>1.2.1.2</li>
    </ul>
    <li>1.2.2</li>
</ul>

Then the code above should echo / print statement like this:

if (1.1) {
    if (1.1.1) {

    } else {

    }
} else {
    if (1.2.1) {
        if (1.2.1.1) {

        }
        else {

        }
    } else {

    }
}

appreciate for your help... :)

Aucun commentaire:

Enregistrer un commentaire