vendredi 30 novembre 2018

PHP If do something, else do nothing problem

I have a maybe funny question, but I need from my code following:

If something - do that, else - do nothing.

Example code is here:

$page = 'id';
if (get_page($page)) {
   #do something 
} else {
   #do nothing
}

Original code:

$page = '4827';
if (get_page($page)) {
   echo do_shortcode('[shortcode]');
} else {
    // do nothing
}

Aucun commentaire:

Enregistrer un commentaire