dimanche 21 août 2016

php refactoring small function

Is it possible to reduce this expression to one line?

    echo '<li>';
    echo $value['name'];
    if ($value['childs']) {
        echo '<ul>';
        echo $this->arrayToString($value['childs']);
        echo '</ul>';
    }
    echo '</li>';

For example:

echo '<li>' . $value['name'] // what to do if statement? ... ;

Aucun commentaire:

Enregistrer un commentaire