PHP-将 NULL 传递给函数的最佳方法是什么?

JRO*_*ROB 0 php

我有一个函数试图将 NULL 值传递给:

function test($this=null, $that=null) {

  if ($this) {
    // Do something
  }

  if ($that) {
    // Do something else
  }

}
Run Code Online (Sandbox Code Playgroud)

因此,如果我尝试仅为 传递值$that,我可以这样做:

$that = 100;

this('',$that);
Run Code Online (Sandbox Code Playgroud)

但是''将 NULL 传递给函数的最佳方法是什么呢?

Daa*_*aan 5

使用null

$that = 100;

test(null,$that);
Run Code Online (Sandbox Code Playgroud)