Tengo una variable de javascript que estoy tratando de enviar a una función de PHP como nula para probar cómo se registra en PHP, sin embargo, no importa lo que haya intentado, PHP no la registrará como nula. He intentado:
let testValue = nully
let testValue = NULLpero el primero todavía se registra con PHP como no nulo y el segundo falla en mi consola y dice que NULL no está definido
PHP lo está buscando así:
if(is_null($testValue)){ dd('null'); }else{ dd('not null'); }¿Por qué la función PHP no reconoce mi primer ejemplo como nulo?
ACTUALIZACIÓN: Código JS con llamada axios:
let testValue = null; axios({ method: 'post', url: test, data:{ testValue: testValue } }).then(function (response) { }).then function (error) { });controlador PHP
public function testingCall(Request $r){ $testValue = $r->testValue; var_dump($testValue); if(is_null($testValue)){ dd('null'); }else{ dd('not null'); } }