I have a javascript variable that I'm trying to send to a PHP function as null in order to test how it's registering in PHP, however, no matter what I've tried PHP won't register it as null. I've tried:
let testValue = null
and
let testValue = NULL
but the first still registers with PHP as not being null and the 2nd fails in my console and says NULL is not defined
PHP is looking for it like so:
if(is_null($testValue)){
dd('null');
}else{
dd('not null');
}
why won't the PHP function recognize my first example as being null?
UPDATE: JS Code with axios call:
let testValue = null;
axios({
method: 'post',
url: test,
data:{
testValue: testValue
}
}).then(function (response) {
}).then function (error) {
});
PHP controller
public function testingCall(Request $r){
$testValue = $r->testValue;
var_dump($testValue);
if(is_null($testValue)){
dd('null');
}else{
dd('not null');
}
}