Syntax
PHP Declare a Variable Syntax
In PHP, declare a variable: variables start with $ — $name = "Ada";
Quick Answer
- Syntax
$name = "Ada";
PHPSyntax
Declare a Variable
Code example
$name = "Ada";
Variables start with $.
How to declare a variable in PHP
- Open your PHP file or editor.
- Copy the example, then replace its sample names and values for your code.
PHP Declare a Variable Syntax
Use $name = "Ada";.
Related Syntax References
Frequently asked questions
What is the PHP syntax for declare a variable?
Use this pattern: $name = "Ada";
Can I copy this PHP code example?
Yes. Use Copy code and adapt the example to your program.
Is this PHP syntax different on Mac or Windows?
No. The language syntax is the same across operating systems.
Official source · How we verify