s.mujahid8 s.mujahid8 - 7 months ago 21
PHP Question

Command in PHP equivalent to alert in javascript

I use the 'alert' command in javascript's to check values of variables so as to debug my code. but i cant find any such command in PHP which shows a simple popup box like the alert command. im new to PHP.

is there something i dont know?

Ex:

$username=$_REQUEST["username"];
$password=$_REQUEST["password"];


Here i just want to find out what values are coming in those variables. if it was javascript, i would simply use alert (username) and alert (password). how to do it in php?
thank you.

Answer

Just echo them

echo "Username:".$username;
echo "<br>";
echo "Password:".$password;

You can also use var_dump

PHP is a server side language and does not provide client side functionality like JavaScript alert()