null stuff

2 years ago

bkilshaw

Code

function doTheThing($isDirectory = null) {
  if($isDirectory != null) {
    if($isDirectory) {
      echo "value is not null and truthy\r";
    } else {
      echo "value is not null and falsey\r";
    }
  } else {
    echo "value is null\r";
  }
}


doTheThing();
doTheThing(true);
doTheThing(false);

Output

value is null
value is not null and truthy
value is null
=> null
New course: Desktop apps with Electron