2 years ago

#47701

test-img

ramses adames

I have echo inside elseif and it does not show in console

I have the following function and I would like to know if it is working correctly because the echo inside else if not seen in the console

function candle($on="",$lighter=""){
  if(!$on and !$lighter){
    echo "The candle is out and I must look for a lighter\n";
    }elseif(!$lighter){
      echo "I already have the lighter\n";
      $lighter=true;
      echo "light candle\n";
      $on=true;
  }  
  echo  "The candle is lit\n";  
}

candle(false,false);

What should I do to show them?

php

echo

0 Answers

Your Answer

Accepted video resources