Home > Mobile >  Display console.log equivalent of PHP onto leetcode console terminal
Display console.log equivalent of PHP onto leetcode console terminal

Time:05-31

How can I console.log/error_log when coding on the leetcode terminal in PHP such that I can see my messages on the console terminal?

enter image description here

CodePudding user response:

You can use standard PHP functions such as: echo, print_r, var_dump.

Example:

Code

Console result

CodePudding user response:

<?php
$txt = "PHP";
echo "I love $txt!";
echo "<script> console.log('".$txt ."')</script>";
// or you can use alert
// echo "<script> alert('".$txt ."')</script>";
?>

  • Related