jeudi 9 juillet 2015

PHP if and else if execution

I am trying to make the below php if and elseif rule to work but i`m stuck

if ($data[0]=="blog") { 
    echo "it is a blog";
} elseif ($data[1]=="") { 
    echo "it`s not a blog";
}

I need to run the code as below:

If the array contains onlu this array(1) { [0]=> string(4) "blog" } to return blog If the array contains onlu this array(2) { [0]=> string(4) "blog" [1]=> string(5) "post1" ...etc } to return post

Aucun commentaire:

Enregistrer un commentaire