Blank space or NULL with PHP 8.1
-
I'm trying to migrate my PHP code which is working on PHP 7.4 to PHP 8.1. With PHP 8.1, following "if" code executes Javascript but with PHP 7.4 it didn’t execute Js part and it was the normal state. If I use null instead of “” after the != will it fix this? and is it correct?
if ($error != "") echo "alert('".str_replace("<br>","\\n",str_replace("\n","\\n",str_replace("\r","",str_replace("'","\'",$error_text))))."');";
-
I'm trying to migrate my PHP code which is working on PHP 7.4 to PHP 8.1. With PHP 8.1, following "if" code executes Javascript but with PHP 7.4 it didn’t execute Js part and it was the normal state. If I use null instead of “” after the != will it fix this? and is it correct?
if ($error != "") echo "alert('".str_replace("<br>","\\n",str_replace("\n","\\n",str_replace("\r","",str_replace("'","\'",$error_text))))."');";