PHP - Bir durumda, hiçbir şey yapmak

0 Cevap php

Bunu söylemek için uygun bir yoldur: bir şey durum ise, hiçbir şey yapmak?

if ( ($hostNameInfo == $hostNameInput) && ($hostAddressInfo == $hostAddressInput) )
{
  return;
}

Update: I'm not inside a function. :( So the return is just nonsense.

Burada daha fazla kodu:

//if the input fields are equal to database values, no need to update and waste resources,hence, do nothing:
if ( ($hostNameInfo == $hostNameInput) && ($hostAddressInfo == $hostAddressInput) )
{
  //do nothing
}
//If, however, (they are NOT equal and) input fields are not empty:
elseif (!empty($hostNameInput) && (!empty($hostAddressInput)))
{
 //do something.
}

Thanks in advance, MEM

0 Cevap