Login
Remember
Register
Ask a Question
Which of the following is the correct way of defining a variable in PHP?
+1
vote
asked
May 11, 2022
in
PHP
by
sharadyadav1986
Which of the following is the correct way of defining a variable in PHP?
a) $variable name = value;
b) $variable_name = value;
c) $variable_name = value
d) $variable name as value;
php-variable
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
May 11, 2022
by
sharadyadav1986
b) $variable_name = value;
Description:
In PHP, a variable is declared using a $ sign followed by the variable name. A PHP variable name cannot contain spaces.
Syntax of declaring a variable in PHP is given below:
$variable_name=value;
...