---
title: "Discussion on \"How to declare a variable in PHP\" | Hashnode"
description: "Discussion on \"How to declare a variable in PHP\". To declare a variable in PHP we write the $ sign before the name of the variable :\nfor example, let's declare a variable named greeting and assign the string Hello to it.\n$greeting=\"Hello\"\nwe can echo out this variable like this: echo \"$greeting Worl..."
url: "https://hashnode.com/posts/how-to-declare-a-variable-in-php/63b32f62453a055d81725e5a"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to declare a variable in PHP](https://saadlittleworld.hashnode.dev/how-to-declare-a-variable-in-php?utm_source=hashnode&utm_medium=feed)

To declare a variable in PHP we write the $ sign before the name of the variable : for example, let's declare a variable named greeting and assign the string Hello to it. $greeting="Hello" we can echo out this variable like this: echo "$greeting Worl...

Jan 2, 2023 · 1 min read · saadlittleworld.hashnode.dev  
Read the article

-   [#php](https://hashnode.com/tag/php)
-   [#noob](https://hashnode.com/tag/noob)
-   [#newbie](https://hashnode.com/tag/newbie)

## Written by

[Saad](https://hashnode.com/@Shoyo)

@Shoyo

  
[View profile](https://hashnode.com/@Shoyo)

Interested in learning PHP,Javascript,Laravel, and Vue

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
