Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Just use this function as testing($your-variable,"php"); for php or testing($your-variable,"js"); for console printing in dev tools
- function testing($variable,$type = "php"){
- if ($type == "js") {
- if (!is_array($variable)) {
- echo "<script>console.log('".$variable."');</script>";
- } else {
- echo "<script>console.log(JSON.stringify(".json_encode($variable).", null, 2));</script>";
- }
- } else {
- if (!is_array($variable)) {
- echo "<br>Function Results: ".$variable."<br>";
- } else {
- echo "<pre>";
- print_r($variable);
- echo "</pre>";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement