---
title: "Displaying message in PHP"  
description: "Here we have an example for showing simple PHP scripting code which sends the text ‘Hello Word’ to client browser.  Example: Displaying message using"  
author: "Anonymous User"  
published: 2011-09-02  
updated: 2020-03-04  
canonical: https://www.mindstick.com/articles/713/displaying-message-in-php  
category: "php"  
tags: ["php"]  
reading_time: 2 minutes  

---

# Displaying message in PHP

Here we have an example for showing [simple](https://www.mindstick.com/blog/63525/get-the-most-out-of-maths-with-these-8-simple-tricks) PHP [scripting](https://www.mindstick.com/blog/183/cross-site-scripting) code which sends the text ‘Hello Word’ to [client](https://www.mindstick.com/articles/23198/3-steps-to-ensure-that-your-client-portal-is-impeccable) browser.\

Example: Displaying [message](https://www.mindstick.com/interview/682/which-are-the-various-message-map-macros) using ‘echo’ statement.

Here we have an example, how to display a message using ‘echo’ statement with PHP.

**Note**: Here I am using notepad text [editor](https://www.mindstick.com/forum/78/how-avoid-the-html-tag-and-remove-the-formating-of-copy-in-ajax-editor) to write the following code.

Example 1: Display ‘Hello Word’ text.

```
<html>   <head>         <title>Hello Word</title> </head><body>        <?php               echo "Hello Word";         ?></body></html>
```

##### Output:

![Displaying message in PHP](https://www.mindstick.com/mindstickarticle/f98da73b-4a74-477c-9607-0fa8a6bf57b0/images/7771bfbe-bec8-4456-bd7e-eb097d143f27.png)

Example2: Use html tag with ‘echo’ statement.

```
<html>   <head><title>My file</title></head><body>        <?php                <%-- // here $faname is a variable--%>              $fname = "Arun Singh";                <%--// here </br> is a html tag to break line               // here . (Dot operator) used for concatenate two string--%>               echo "Welcome "." ". $fname." ".  "</br>".  "in"  ;                <%--// here <h5> </h5> is a heading tag --%>               echo "<h5>".  "Mindstick".  "</h5>";         ?></body></html>
```

##### Output:

![Displaying message in PHP](https://www.mindstick.com/mindstickarticle/f98da73b-4a74-477c-9607-0fa8a6bf57b0/images/2bd93bbe-edc8-4460-9b35-24e130e8a46e.png)

**Example 3:** Display numeric value with ‘echo’ statement.

```
<html>   <head><title>My file</title></head><body>        <?php                <%--// assigned numeric value in variable 'decimal'--%>              $decimal = 105;               echo $decimal ;         ?></body></html>
```

##### Output:

![Displaying message in PHP](https://www.mindstick.com/mindstickarticle/f98da73b-4a74-477c-9607-0fa8a6bf57b0/images/f171b55e-960d-4b1d-806e-0b10d039248b.png)

Each code line in PHP should have semicolon at the end of line, because semicolon (;) is a separator used to distinguish one line code to another one.

Note: File must have php extension such as .php, .php3 or .php4 etc. Now save this file with ‘helloword.php’ name.

##### Deploying php file into WAMP Server:

To deploy ‘helloword.php’ file into WAMP server, open the directory where wamp server is installed, and suppose that the installed directory path is ‘C: \wamp\’, open ‘C: \wamp\www\’ directory path and create a folder and put all .php file in it.

Now let’s have snapshot, how to deploy .php file into wamp server.

Step 1: Open ‘C: \wamp\’ directory.

![Displaying message in PHP](https://www.mindstick.com/mindstickarticle/f98da73b-4a74-477c-9607-0fa8a6bf57b0/images/f807680a-8dbb-446c-998e-7bedc6852b15.png)

Click on ‘WWW’ [directory](https://www.mindstick.com/forum/226/how-to-get-application-directory-using-c-sharp-csharp).

Step 2: Create your own directory to [store](https://www.mindstick.com/articles/12379/magento-store-locator-extension-with-google-map) .php file.

![Displaying message in PHP](https://www.mindstick.com/mindstickarticle/f98da73b-4a74-477c-9607-0fa8a6bf57b0/images/4f262a80-80da-4900-b54f-2b89b64e4c5f.png)

Click on ‘MyFiles’ directory.

![Displaying message in PHP](https://www.mindstick.com/mindstickarticle/f98da73b-4a74-477c-9607-0fa8a6bf57b0/images/827a7177-ef5a-4470-b4b7-522a73c8152c.png)

Step 3: To open this file on [web browser](https://answers.mindstick.com/qa/95505/what-are-the-pros-and-cons-of-using-safari-web-browser), start wamp [server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over) and click on ‘localhost’

![Displaying message in PHP](https://www.mindstick.com/mindstickarticle/f98da73b-4a74-477c-9607-0fa8a6bf57b0/images/9e918f9e-c11e-4a3c-b830-c6f6779932fd.png)

Click on ‘My files’ directory.

![Displaying message in PHP](https://www.mindstick.com/mindstickarticle/f98da73b-4a74-477c-9607-0fa8a6bf57b0/images/880648fb-0083-4182-9abc-48723d81ef7a.png)

Click on ‘helloword.php’ file link.

![Displaying message in PHP](https://www.mindstick.com/mindstickarticle/f98da73b-4a74-477c-9607-0fa8a6bf57b0/images/6fce3aec-b06d-4603-9311-d471b4677e80.png)

This is your desired result.

![Displaying message in PHP](https://www.mindstick.com/mindstickarticle/f98da73b-4a74-477c-9607-0fa8a6bf57b0/images/bb796616-0230-46c7-a0b1-a52220a1b743.png)

\

---

Original Source: https://www.mindstick.com/articles/713/displaying-message-in-php

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
