Home > PHP > PHP – Example 0004

PHP – Example 0004


Fourth Example 0004

<html>
<head>
<title>Fourth example</title>
</head>

// Fourth Example (VARIABLES INSIDE A STRINGS)
// ————————

$name = “Xarabas”;
echo “Hi, $name”;
echo ” <br />”;
echo ‘Hi, $name’;
echo ” <br />”;

?>

</body>
</html>

================================================================================

In this example, we see the using of variables inside a string.
In
echo “Hi, $name”;
here the variable $name is evaluated because we use a double quote ( ).

In
echo ‘Hi, $name’;
here the variable $name isn’t evaluated because we use  a single quote ( ).

The output window you will see the following:

Hi, Xarabas
Hi, $name

Categories: PHP
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: