Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

console.log for php

<?php
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;
}

#Let's use this :) 

$name = "Omar Faruk"; // string type variable

console_log($name); // "Omar Faruk"
console_log(gettype($name)); // string


// now go to the browser and check the console 
Source by www.atatus.com #
 
PREVIOUS NEXT
Tagged: #php
ADD COMMENT
Topic
Name
5+8 =