Problems in understanding the operator ' s work



  • switch (Wo_UrlAvailable()) {
       case "https://www.google/": {
          echo "Google is available";
          break;
       }
       case "https://yandex.ru/": {
          echo "Yandex is available";
          break;
       }
    }
    

    How to hand over the case https://www.google/ https://yandex.ru/ As an argument for the function of Wo_UrlAvailable(), which is an argument for switch.

    Wo_UrlAvailable() - checks whether url is available (simply speaking, ping and returns the result true/false if the site is so true)



  • If I've got it right, I'll have to say,

    switch (true) {
       case Wo_UrlAvailable('google') {
          echo "Google is available";
          break;
       }
       case Wo_UrlAvailable('yandex'): {
          echo "Yandex is available";
          break;
       }
    }
    

    Method Wo_UrlAvailable One string parameter with the name of the service shall be accepted and the accessibility checks shall be made


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2