Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. Blank space or NULL with PHP 8.1

Blank space or NULL with PHP 8.1

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
javascripthelpphpquestion
2 Posts 2 Posters 21 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aruna KN
    wrote on last edited by
    #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))))."');";

    L 1 Reply Last reply
    0
    • A Aruna KN

      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))))."');";

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I have tried that code in version 7 and 8 and get the same results in both. You need to provide some more details.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups