Console log for php

    0

    0

    This function prints the text output to the console. If the $with_script_tags flag is set to true, the function also includes a JavaScript code fragment that outputs the string to the console.

    function console_log($output, $with_script_tags = true) {
      $js_code = 'console.log(' . json_encode($output, JSON_HEX_TAG) . 
    ');';
      if ($with_script_tags) {
        $js_code = '<script>' . $js_code . '</script>';
      }
      echo $js_code;
    }
    
    console_log();
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.