<?php $message = "Thanks.."; echo "<script>console.log('".$message."');</script>"; ?> Output: Thanks..